import Vue from 'vue';
import CertDetail from './Popup.vue';
const domId = 'proper-info';
const proper = {
install: (info = {}) => {
let properDom = document.getElementById(domId);
if (properDom) {
return;
}
properDom = document.createElement('div');
properDom.setAttribute('id', domId);
const DetailVNode = Vue.extend(CertDetail);
const instance = new DetailVNode({
propsData: {
info,
},
});
instance.$mount();
document.body.appendChild(instance.$el);
},
destroy: () => {
const properDom = document.getElementById(domId);
if (!properDom) {
return;
}
document.body.removeChild(properDom);
},
};
export default proper;
<template>
<div id="proper-info">
<div>
{{ info.message }}
</div>
</div>
</template>
<script>
export default {
name: 'Popup',
props: {
info: {
type: Object,
default: () => {},
},
},
data() {
return {
};
},
</script>
可以绑定到Vue的原型对象,也可以挂载在全局实例上,剩下的各自发挥哈!!!
样式诸位大神自己写哈!!!!!!!!!