chore(Toast): improve render

This commit is contained in:
chenjiahan 2020-09-25 17:12:03 +08:00
parent 5ccd2129b9
commit a583c83c25

View File

@ -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,
};
}, },
}); });