1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import i18n from '@/util/lang/lang'
- let dom = null
- async function asyncConstructor (Vue, comp) {
- if (!comp) {
- let component = await import('./index.vue')
- comp = Vue.extend(component.default)
- return comp
- }
- return comp
- }
- let otherInfo = {}
- otherInfo.install = function (Vue, store, router) {
- let instance
- Vue.prototype.$showOtherInfo = async (userId = 0) => {
- let Constructor = await asyncConstructor(Vue, dom)
- if (instance) {
- document.body.removeChild(instance.$el)
- instance = null
- }
- instance = new Constructor({
- el: document.createElement('div'),
- router,
- computed: {
- $store () { return store }
- },
- i18n,
- data () {
- return {
- visible: false,
- userId
- }
- }
- })
- document.body.appendChild(instance.$el)
- }
- }
- export default otherInfo
|