You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-app/components/mount/index.js

39 lines
899 B

/*
* @Author: ch
* @Date: 2022-04-19 16:14:03
* @LastEditors: ch
* @LastEditTime: 2022-04-19 17:20:08
* @Description: file content
*/
import Confirm from '../UiConfirm.vue';
export default {
install (Vue) {
// 创建构造类
const ConfirmConstructor = Vue.extend(Confirm)
const showNextConfirm = function (options) {
// 实例化组件
const instance = new ConfirmConstructor({
el: document.createElement('div')
})
// 处理参数
for (const prop in options) {
instance[prop] = options[prop];
}
// 插入Body
document.body.appendChild(instance.$el)
Vue.nextTick(() => {
instance.show = true
})
}
const confirmFn = (options) => {
return showNextConfirm(options);
}
Vue.prototype.$msb ?
Vue.prototype.$msb.confirm = confirmFn :
Vue.prototype.$msb={confirm : confirmFn }
}
}