<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
});