mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(Toast): improve render
This commit is contained in:
parent
5ccd2129b9
commit
a583c83c25
@ -1,4 +1,4 @@
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref, watch, getCurrentInstance } from 'vue';
|
||||
import { isObject, inBrowser } from '../utils';
|
||||
import { mountComponent, usePopupState } from '../utils/mount-component';
|
||||
import VanToast from './Toast';
|
||||
@ -55,25 +55,21 @@ function createInstance() {
|
||||
state.message = value;
|
||||
});
|
||||
|
||||
return {
|
||||
open,
|
||||
state,
|
||||
clear: close,
|
||||
toggle,
|
||||
message,
|
||||
onClosed,
|
||||
};
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
getCurrentInstance().render = () => (
|
||||
<VanToast
|
||||
{...{
|
||||
...this.state,
|
||||
onClosed: this.onClosed,
|
||||
'onUpdate:show': this.toggle,
|
||||
...state,
|
||||
onClosed,
|
||||
'onUpdate:show': toggle,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
return {
|
||||
open,
|
||||
clear: close,
|
||||
message,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user