【发布时间】:2021-06-14 15:11:43
【问题描述】:
我正在使用以下代码来动态创建 vue 组件。我希望他们与 vuex 商店通信,但看起来他们无法访问它。有谁知道如何解决这个问题?
let module = this.modules.find(m => m.name === name)
const ModClass = Vue.extend(module.component);
const modInstance = new ModClass({
propsData: {
client: this.client,
}
});
modInstance.$mount();
modInstance.$on('close', () => {
modInstance.$destroy(true);
(modInstance.$el).remove();
})
this.$refs.panels.appendChild(modInstance.$el);
【问题讨论】: