Vue 设置添加 JSON 视图不更新

 1         for (let i = 0; i < this.gotup.length; i++) {
 2                 const element = this.gotup[i];
 3                 console.log(element);
 4                 if (element) {
 5                 }
 6                 for (let io = 0; io < element.LstAttValue.length; io++) {
 7                     const elements = element.LstAttValue[io];
 8                     if (ValueId == elements.AttValueId) {
 9                         // Object.assign(elements, {不起作用的
10                         //     isTrue: false 
11                         // });
12                         // elements.isTrue = true;  不起作用的
13                         // elements[isTrue] = true; 不起作用的
14                         this.$set(elements, "isTrue", true); // 这样才对
15                     } else {
16                         this.$set(elements, "isTrue", false);
17                     }
18                     console.log(elements);
19                 }
20             }

猜你喜欢

转载自www.cnblogs.com/hasubasora/p/9559407.html