Skip to content

Commit 0afa0bb

Browse files
author
puhui999
committed
【缺陷修复】IoT: 物模型编辑已经添加的结构体,里面的参数加不上
1 parent 4f1c79b commit 0afa0bb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/views/iot/thingmodel/dataSpecs/ThingModelStructDataSpecs.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
:rules="[{ required: true, validator: validateList, trigger: 'change' }]"
66
label="JSON 对象"
77
>
8-
<!-- TODO @puhui999:编辑已经添加的结构体,里面的参数加不上 -->
98
<div
109
v-for="(item, index) in dataSpecsList"
1110
:key="index"
@@ -118,9 +117,6 @@ const submitForm = async () => {
118117
}
119118
120119
// 查找是否已有相同 identifier 的项
121-
if (isEmpty(dataSpecsList.value)) {
122-
dataSpecsList.value = []
123-
}
124120
const existingIndex = dataSpecsList.value.findIndex(
125121
(spec) => spec.identifier === data.identifier
126122
)
@@ -158,6 +154,13 @@ const validateList = (_: any, __: any, callback: any) => {
158154
}
159155
callback()
160156
}
157+
158+
/** 组件初始化 */
159+
onMounted(async () => {
160+
await nextTick()
161+
// 预防 dataSpecsList 空指针
162+
isEmpty(dataSpecsList.value) && (dataSpecsList.value = [])
163+
})
161164
</script>
162165

163166
<style lang="scss" scoped>

0 commit comments

Comments
 (0)