【issues/860】生成的一对多代码,热更新之后点击新增卡死

pull/975/head v3.6.1
zhangdaiscott 2023-12-08 21:20:17 +08:00
parent 348a8a3f6a
commit 3c0f15bb6e
1 changed files with 13 additions and 2 deletions

View File

@ -18,8 +18,13 @@ import JVxeTextareaCell from './components/cells/JVxeTextareaCell.vue';
// import JVxeDepartSelectCell from './components/cells/JVxeDepartSelectCell.vue'
// import JVxeUserSelectCell from './components/cells/JVxeUserSelectCell.vue'
const componentMap = new Map<JVxeTypes | string, JVxeVueComponent>();
let componentMap = new Map<JVxeTypes | string, JVxeVueComponent>();
// update-begin--author:liaozhiyang---date:20231208---for【issues/860】生成的一对多代码热更新之后点击新增卡死[暂时先解决]
const JVxeComponents = 'JVxeComponents__';
if (import.meta.env.DEV && componentMap.size === 0 && window[JVxeComponents] && window[JVxeComponents].size > 0) {
componentMap = window[JVxeComponents];
}
// update-end--author:liaozhiyang---date:20231027---for【issues/860】生成的一对多代码热更新之后点击新增卡死[暂时先解决]
/** span 组件结尾 */
export const spanEnds: string = ':span';
@ -50,11 +55,17 @@ export function addComponent(type: JVxeTypes, component: JVxeVueComponent, spanC
if (spanComponent) {
componentMap.set(type + spanEnds, spanComponent);
}
// update-begin--author:liaozhiyang---date:20231208---for【issues/860】生成的一对多代码热更新之后点击新增卡死[暂时先解决]
import.meta.env.DEV && (window[JVxeComponents] = componentMap);
// update-end--author:liaozhiyang---date:20231208---for【issues/860】生成的一对多代码热更新之后点击新增卡死[暂时先解决]
}
export function deleteComponent(type: JVxeTypes) {
componentMap.delete(type);
componentMap.delete(type + spanEnds);
// update-begin--author:liaozhiyang---date:20231208---for【issues/860】生成的一对多代码热更新之后点击新增卡死[暂时先解决]
import.meta.env.DEV && (window[JVxeComponents] = componentMap);
// update-end--author:liaozhiyang---date:20231208---for【issues/860】生成的一对多代码热更新之后点击新增卡死[暂时先解决]
}
/** 定义内置自定义组件 */