Commit 7deefb79f88db551f3d0065efa593e2085009678
1 parent
ed905973
fix(src/packages/components): 修改多个实时组合,页面崩溃问题,移除不需要代码
Showing
1 changed file
with
4 additions
and
25 deletions
@@ -6,12 +6,8 @@ | @@ -6,12 +6,8 @@ | ||
6 | <n-code word-wrap :code="toString(targetData.option.dataset)" language="json"></n-code> | 6 | <n-code word-wrap :code="toString(targetData.option.dataset)" language="json"></n-code> |
7 | </n-card> | 7 | </n-card> |
8 | <n-tag type="info"> 目前支持实时多属性 </n-tag> | 8 | <n-tag type="info"> 目前支持实时多属性 </n-tag> |
9 | - <!-- <n-tag type="warning">示例:res.xxxx</n-tag> --> | ||
10 | - <!-- <span>目前支持实时多属性</span> --> | ||
11 | - <!-- <n-input type="textarea" @input="handleTestInput($event, option)" size="small" placeholder="请输入"></n-input> | ||
12 | - <n-code word-wrap :code="toString(testInputValue)" language="json"></n-code> --> | ||
13 | <n-divider /> | 9 | <n-divider /> |
14 | - <div v-for="(item, index) in cacheGroupList" :key="item.key + index"> | 10 | + <div v-for="(item, index) in groupList" :key="item.key + index"> |
15 | <n-space justify="space-between"> | 11 | <n-space justify="space-between"> |
16 | <n-ellipsis> 组件id </n-ellipsis> | 12 | <n-ellipsis> 组件id </n-ellipsis> |
17 | <n-input size="small" v-model:value="item.id" :disabled="true"></n-input> | 13 | <n-input size="small" v-model:value="item.id" :disabled="true"></n-input> |
@@ -28,7 +24,6 @@ | @@ -28,7 +24,6 @@ | ||
28 | </n-space> | 24 | </n-space> |
29 | <n-space vertical justify="space-between"> | 25 | <n-space vertical justify="space-between"> |
30 | <n-ellipsis>数据内容 </n-ellipsis> | 26 | <n-ellipsis>数据内容 </n-ellipsis> |
31 | - <!-- @update:value="handleInput(groupList!, item.id, $event)" --> | ||
32 | <n-input | 27 | <n-input |
33 | type="textarea" | 28 | type="textarea" |
34 | size="small" | 29 | size="small" |
@@ -54,28 +49,16 @@ const { targetData } = useTargetData() | @@ -54,28 +49,16 @@ const { targetData } = useTargetData() | ||
54 | 49 | ||
55 | const { groupList, option } = toRefs(targetData.value as unknown as Recordable) | 50 | const { groupList, option } = toRefs(targetData.value as unknown as Recordable) |
56 | 51 | ||
57 | -const cacheGroupList = computed(()=>{ | ||
58 | - return (groupList.value as unknown as CreateComponentType[]).reverse() | ||
59 | -}) | ||
60 | - | ||
61 | const saveHistoryInputValueList = ref<saveHistoryInputValueListType>([]) | 52 | const saveHistoryInputValueList = ref<saveHistoryInputValueListType>([]) |
62 | 53 | ||
63 | -const handleSelectDataKey = (key:string, options:SelectOption[], currentComponentId:string, groupList:CreateComponentType[]) => { | ||
64 | - saveHistoryInputValueList.value.push({ | 54 | +const handleSelectDataKey = (key:string, _:SelectOption[], currentComponentId:string, groupList:CreateComponentType[]) => { |
55 | + saveHistoryInputValueList.value.unshift({ | ||
65 | id:currentComponentId, | 56 | id:currentComponentId, |
66 | inputValue:key | 57 | inputValue:key |
67 | }) | 58 | }) |
68 | handleGroupListById(groupList, currentComponentId, key, option.value.dataset) | 59 | handleGroupListById(groupList, currentComponentId, key, option.value.dataset) |
69 | } | 60 | } |
70 | 61 | ||
71 | -// const handleInput = (groupList: CreateComponentType[], id: string, inputValue: string) => { | ||
72 | -// saveHistoryInputValueList.value.unshift({ | ||
73 | -// id, | ||
74 | -// inputValue | ||
75 | -// }) | ||
76 | -// handleGroupListById(groupList, id, inputValue, option.value.dataset) | ||
77 | -// } | ||
78 | - | ||
79 | const executeFn = (inputValue: string, dataset: any) => { | 62 | const executeFn = (inputValue: string, dataset: any) => { |
80 | try { | 63 | try { |
81 | return Function('res', `return ${dataset[inputValue]}`)(dataset) | 64 | return Function('res', `return ${dataset[inputValue]}`)(dataset) |
@@ -119,10 +102,6 @@ const dataCacheKeys = computed(()=>{ | @@ -119,10 +102,6 @@ const dataCacheKeys = computed(()=>{ | ||
119 | return [] | 102 | return [] |
120 | }) | 103 | }) |
121 | 104 | ||
122 | -const cacheTargetDataGroupList = computed(()=>{ | ||
123 | - return (targetData.value?.groupList as unknown as CreateComponentType[]).reverse() | ||
124 | -}) | ||
125 | - | ||
126 | watch( | 105 | watch( |
127 | () => targetData.value, | 106 | () => targetData.value, |
128 | (newValue: CreateComponentType | CreateComponentGroupType) => { | 107 | (newValue: CreateComponentType | CreateComponentGroupType) => { |
@@ -132,7 +111,7 @@ watch( | @@ -132,7 +111,7 @@ watch( | ||
132 | newValue.saveHistoryInput = JSON.stringify(uniqHistoryInputValueList) | 111 | newValue.saveHistoryInput = JSON.stringify(uniqHistoryInputValueList) |
133 | window.localStorage.setItem('CACHE_HISTORY_INPUT_VALUE', JSON.stringify(uniqHistoryInputValueList)) | 112 | window.localStorage.setItem('CACHE_HISTORY_INPUT_VALUE', JSON.stringify(uniqHistoryInputValueList)) |
134 | } | 113 | } |
135 | - cacheTargetDataGroupList.value?.forEach((item: CreateComponentType) => { | 114 | + newValue?.groupList?.forEach((item: CreateComponentType) => { |
136 | uniqHistoryInputValueList.forEach((uniqueItem: historyInputValue) => { | 115 | uniqHistoryInputValueList.forEach((uniqueItem: historyInputValue) => { |
137 | if (uniqueItem.id === item.id) { | 116 | if (uniqueItem.id === item.id) { |
138 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion | 117 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |