import { createApp } from 'vue' import necessaryInfoDialog from './components/necessaryInfoDialog.vue' import positionAd from './components/positionAd.vue' import vuetify from '@/plugins/vuetify' // import { showImprovePersonaInfo } from '@/utils/whiteList' // import router from '@/router' const toastMessage = (type, option = {}) => { // debugger // if (type === 'necessaryInfoDialog' && router && showImprovePersonaInfo(router.path)) return return new Promise((resolve, reject) => { const componentName = type === 'necessaryInfoDialog' ? necessaryInfoDialog : type === 'positionAd' ? positionAd : null // const rootNode = document.createElement("div") document.querySelector('.v-application').appendChild(rootNode) const app = createApp(componentName, { // title, // text, option, cancel () { app.unmount() rootNode.remove() if (option.cancelCallback) { reject() } }, sure () { app.unmount() rootNode.remove() resolve() }, other () { app.unmount() rootNode.remove() resolve({ otherClick: true }) } }) app.use(vuetify) app.mount(rootNode) }) } // 注册插件app.use()会自动执行install函数 toastMessage.install = (app) => { app.config.globalProperties.Curtain = toastMessage } export default toastMessage