当前位置:网站首页>el-cascader回显失败;el-cascader回显不出来
el-cascader回显失败;el-cascader回显不出来
2022-07-01 05:07:00 【i_am_a_div_日积月累_】
—我的是省市联动,选择时候是正常的,得到的绑定值是数组 [‘安徽’,‘黄山’],没问题;
但是在详情查看时候,回显成[‘安徽’,‘黄山’],下拉框却不显示回显值。—原因:虽然data里初始化声明变量是数组了,但是在赋值时候必须再次先声明为数组 [ ],然后再赋值。或者是直接数组塞入值。
<el-cascader v-model="shengshi" :options="areaOptions2" placeholder="省市" ></el-cascader>
export default {
data () {
return {
shengshi: [],
}
},
methods: {
getInfo () {
if (res.data.province && res.data.city) {
// el-cascader 回显 要不先定义空数组 然后下标赋值 要不就是直接把值塞入数组
// 直接赋值不行
// this.shengshi[0] = res.data.province
// this.shengshi[1] = res.data.city
// 先声明是数组 再赋值也可以
// this.shengshi = []
// this.shengshi[0] = res.data.province
// this.shengshi[1] = res.data.city
// 直接数组塞入值也可以
this.shengshi = [res.data.province, res.data.city]
} else {
this.shengshi = []
}
}
},
}
边栏推荐
- STM32扩展版 按键扫描
- LevelDB源码分析之memtable
- [daily question in summer] letter delivery by p1629 postman in Luogu (to be continued...)
- Neural network - nonlinear activation
- [daily question in summer] Luogu p5740 [deep foundation 7. Example 9] the best student
- Query long transaction
- 复制宝贝提示材质不能为空,如何解决?
- 智慧运维:基于 BIM 技术的可视化管理系统
- 1076 Forwards on Weibo
- [data recovery in North Asia] a data recovery case of raid crash caused by hard disk drop during data synchronization of hot spare disk of RAID5 disk array
猜你喜欢

Oracle views the creation time of the tablespace in the database

Use of dataloader
![Solution: thread 1:[< *> setvalue:forundefined key]: this class is not key value coding compliant for the key*](/img/88/0b99d1db2cdc70ab72d2b3c623dfaa.jpg)
Solution: thread 1:[< *> setvalue:forundefined key]: this class is not key value coding compliant for the key*

Use of STM32 expansion board temperature sensor and temperature humidity sensor

CockroachDB 分布式事务源码分析之 TxnCoordSender

Distributed architecture system splitting principles, requirements and microservice splitting steps

Actual combat: gateway api-2022.2.13

Leetcode522- longest special sequence ii- hash table - String - double pointer

工业导电滑环的应用

Single page application
随机推荐
Basic skeleton of neural network nn Use of moudle
Global and Chinese market of search engine optimization (SEO) software 2022-2028: Research Report on technology, participants, trends, market size and share
【暑期每日一题】洛谷 P5740【深基7.例9】最厉害的学生
Global and Chinese markets of InGaAs APD arrays 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of enterprise wireless LAN 2022-2028: Research Report on technology, participants, trends, market size and share
STM32 photoresistor sensor & two channel AD acquisition
LeetCode_ 66 (plus one)
Global and Chinese markets of superconductor 2022-2028: Research Report on technology, participants, trends, market size and share
QDataStream的简单读写验证
Unity drags and modifies scene camera parameters under the editor
Global and Chinese markets for soft ferrite cores 2022-2028: Research Report on technology, participants, trends, market size and share
Pico Neo3手柄抓取物体
[daily question in summer] Luogu p5740 [deep foundation 7. Example 9] the best student
Neural networks - use sequential to build neural networks
如何选择导电滑环材料
Query long transaction
Data loading and preprocessing
手动实现一个简单的栈
LeetCode1497-检查数组对是否可以被 k 整除-数组-哈希表-计数
Leetcode316- remove duplicate letters - stack - greedy - string
