封裝一個打開 dialog 的函數

import Dialog from './Dialog.vue' import { createApp. h } from 'vue' export const openDialog = options => { const {title, content} = options const div = document.createElement('div') document.body.appendChild(div) const app = createApp({ render() { return h(Dialog, {visible: true, 'onUpdate:visible': newVisible => { if (newVisible === false) { app.unmount(div) div.remove() } }}, {title, content}) } }) }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章