fix(Toast): failed to update message (#9196)

This commit is contained in:
neverland
2021-08-06 18:58:07 +08:00
committed by GitHub
parent 3a1c8a9d16
commit cf86a23c51
2 changed files with 10 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
import { ref, App, TeleportProps, getCurrentInstance } from 'vue';
import { ref, App, TeleportProps, getCurrentInstance, watch } from 'vue';
import {
extend,
isObject,
@@ -87,14 +87,14 @@ function createInstance() {
onClosed,
'onUpdate:show': toggle,
};
if (message.value) {
attrs.message = message.value;
}
return <VanToast {...state} {...attrs} />;
};
// support dynamic modification of message
watch(message, (val) => {
state.message = val;
});
// rewrite render function
(getCurrentInstance() as any).render = render;