<el-row class="tree-row" v-for="item in geoTreeBox" :key="item.id">
<el-col :span="2">
<img class="drawer-tree-img" src="/static/images/layer.png" alt />
</el-col>
<el-col :span="16">
<div class="drawer-tree-text">{{item.idtext}}</div>
</el-col>
<el-col :span="6">
<el-switch
v-model="item.status"
active-color="#409EFF"
inactive-color="#ccc"
@change="geoMapChange($event,item.idtext)"
></el-switch>
</el-col>
</el-row>
需要改變數組賦值方式如下:
this.$set(this.geoTreeBox, i, {//這樣才能觸發switch開關
id: i,
idview: "",
idtext: TreeData.layerTreeGeoMapGroup[i],
status: false
});