赞
踩
问题:下拉框数据是通过接口请求得到的, 通过change事件打印, select绑定的值和options的值,也能对应起来, 数据类型也一致, 排除了数据的原因, 应该就是视图没有更新了:
原因: 问过度娘后得知, 是因为数据层数太多, render函数没有更新,
解决方法:
1. 使用forceUpdate手动强制刷新
在select 里添加以下代码
@change="$forceUpdate()"
2. 使用$set重新
赋值
- <el-select v-model="item.value" @change="aa(index,dataList[index].value)">
- <el-option
- v-for="items in memberList"
- :key="items.id"
- :label="items.name"
- :value="items.id"
- />
- </el-select>
- aa(num, val) {
- if (val) {
- this.$set(this.dataList, this.dataList[num].value, val)
- } else {
- this.$set(this.dataList, this.dataList[num].value, '')
- }
- },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。