Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pobu168 committed May 7, 2021
1 parent cb36330 commit a36215b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions terraform-ui/src/pages/components/tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,15 @@ export default {
let attr = attrs.slice(0, attrs.length - 1)
let copyData = this.renderValue(this.jsonJ, attr)
if (Object.keys(copyData).length === 1) {
let attr2 = attrs.slice(0, attrs.length - 2)
let copyData2 = this.renderValue(this.jsonJ, attr2)
const key = attr.slice(-1)[0]
copyData2[key] = ''
// 只剩一个母节点情况
if (attrs.length === 1) {
this.jsonJ = {}
} else {
let attr2 = attrs.slice(0, attrs.length - 2)
let copyData2 = this.renderValue(this.jsonJ, attr2)
const key = attr.slice(-1)[0]
copyData2[key] = ''
}
} else {
delete copyData[data.key]
}
Expand Down

0 comments on commit a36215b

Please sign in to comment.