使用gridstack渲染自定义组件
const gsAddRemoveVueComponents = (
host: HTMLElement,
item: GridStackWidget,
add: boolean,
isGrid: boolean
) => {
if (!host) {
return;
}
// Not supported yet
if (isGrid) {
return;
}
//新增组件
if (add) {
//虚拟节点
const itemVNode = getvNode(_itemInfo);
//重要:手动设置上下文,否则子组件无法获取全局注入组件,路由,vuex等等
itemVNode.appContext=appContext;
const _div = document.createElement('div');
render(itemVNode, _div);
return itemVNode.el;
}
};