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 { isObject, inBrowser } from '../utils';
|
||||||
import { mountComponent, usePopupState } from '../utils/mount-component';
|
import { mountComponent, usePopupState } from '../utils/mount-component';
|
||||||
import VanToast from './Toast';
|
import VanToast from './Toast';
|
||||||
@ -55,25 +55,21 @@ function createInstance() {
|
|||||||
state.message = value;
|
state.message = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
getCurrentInstance().render = () => (
|
||||||
open,
|
|
||||||
state,
|
|
||||||
clear: close,
|
|
||||||
toggle,
|
|
||||||
message,
|
|
||||||
onClosed,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<VanToast
|
<VanToast
|
||||||
{...{
|
{...{
|
||||||
...this.state,
|
...state,
|
||||||
onClosed: this.onClosed,
|
onClosed,
|
||||||
'onUpdate:show': this.toggle,
|
'onUpdate:show': toggle,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
open,
|
||||||
|
clear: close,
|
||||||
|
message,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user