...
|
...
|
@@ -11,7 +11,7 @@ |
11
|
11
|
<!-- <n-input type="textarea" @input="handleTestInput($event, option)" size="small" placeholder="请输入"></n-input>
|
12
|
12
|
<n-code word-wrap :code="toString(testInputValue)" language="json"></n-code> -->
|
13
|
13
|
<n-divider />
|
14
|
|
- <div v-for="(item, index) in groupList" :key="item.key + index">
|
|
14
|
+ <div v-for="(item, index) in cacheGroupList" :key="item.key + index">
|
15
|
15
|
<n-space justify="space-between">
|
16
|
16
|
<n-ellipsis> 组件id </n-ellipsis>
|
17
|
17
|
<n-input size="small" v-model:value="item.id" :disabled="true"></n-input>
|
...
|
...
|
@@ -52,12 +52,16 @@ import { SelectOption } from 'naive-ui' |
52
|
52
|
|
53
|
53
|
const { targetData } = useTargetData()
|
54
|
54
|
|
55
|
|
-const { groupList, option } = toRefs(targetData.value)
|
|
55
|
+const { groupList, option } = toRefs(targetData.value as unknown as Recordable)
|
|
56
|
+
|
|
57
|
+const cacheGroupList = computed(()=>{
|
|
58
|
+ return (groupList.value as unknown as CreateComponentType[]).reverse()
|
|
59
|
+})
|
56
|
60
|
|
57
|
61
|
const saveHistoryInputValueList = ref<saveHistoryInputValueListType>([])
|
58
|
62
|
|
59
|
63
|
const handleSelectDataKey = (key:string, options:SelectOption[], currentComponentId:string, groupList:CreateComponentType[]) => {
|
60
|
|
- saveHistoryInputValueList.value.unshift({
|
|
64
|
+ saveHistoryInputValueList.value.push({
|
61
|
65
|
id:currentComponentId,
|
62
|
66
|
inputValue:key
|
63
|
67
|
})
|
...
|
...
|
@@ -115,6 +119,10 @@ const dataCacheKeys = computed(()=>{ |
115
|
119
|
return []
|
116
|
120
|
})
|
117
|
121
|
|
|
122
|
+const cacheTargetDataGroupList = computed(()=>{
|
|
123
|
+ return (targetData.value?.groupList as unknown as CreateComponentType[]).reverse()
|
|
124
|
+})
|
|
125
|
+
|
118
|
126
|
watch(
|
119
|
127
|
() => targetData.value,
|
120
|
128
|
(newValue: CreateComponentType | CreateComponentGroupType) => {
|
...
|
...
|
@@ -124,7 +132,7 @@ watch( |
124
|
132
|
newValue.saveHistoryInput = JSON.stringify(uniqHistoryInputValueList)
|
125
|
133
|
window.localStorage.setItem('CACHE_HISTORY_INPUT_VALUE', JSON.stringify(uniqHistoryInputValueList))
|
126
|
134
|
}
|
127
|
|
- newValue?.groupList?.forEach((item: CreateComponentType) => {
|
|
135
|
+ cacheTargetDataGroupList.value?.forEach((item: CreateComponentType) => {
|
128
|
136
|
uniqHistoryInputValueList.forEach((uniqueItem: historyInputValue) => {
|
129
|
137
|
if (uniqueItem.id === item.id) {
|
130
|
138
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
...
|
...
|
|