当前位置:网站首页>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 = []
}
}
},
}
边栏推荐
猜你喜欢

C read / write application configuration file app exe. Config and display it on the interface

Neural network - nonlinear activation

Solution: drag the Xib control to the code file, and an error setvalue:forundefined key:this class is not key value coding compliant for the key is reported
![[NLP Li Hongyi] notes](/img/8e/a51ca5eee638facd54270fb28d2fce.jpg)
[NLP Li Hongyi] notes

LeetCode1497-检查数组对是否可以被 k 整除-数组-哈希表-计数

STM32 photoresistor sensor & two channel AD acquisition

How to use common datasets in pytorch

导电滑环使用的注意事项

How to meet the requirements of source code confidentiality and source code security management
![[hard ten treasures] - 2 [basic knowledge] characteristics of various topological structures of switching power supply](/img/c2/6dfb9f477306edb46ff2a6a6ca32dd.png)
[hard ten treasures] - 2 [basic knowledge] characteristics of various topological structures of switching power supply
随机推荐
Global and Chinese market of metal oxide semiconductor field effect transistors 2022-2028: Research Report on technology, participants, trends, market size and share
[summer daily question] Luogu p5886 Hello, 2020!
Global and Chinese market of mainboard 2022-2028: Research Report on technology, participants, trends, market size and share
缓冲流与转换流
LeetCode_ 58 (length of last word)
LevelDB源码分析之LRU Cache
Like cloud functions
分布式架构系统拆分原则、需求、微服务拆分步骤
Global and Chinese market for kitchen range hoods 2022-2028: Research Report on technology, participants, trends, market size and share
RuntimeError: “max_pool2d“ not implemented for ‘Long‘
Global and Chinese markets for business weather forecasting 2022-2028: Research Report on technology, participants, trends, market size and share
[daily question in summer] Luogu p2026 find the analytic formula of primary function
每日一题-LeetCode1175-质数排列-数学
Vérification simple de la lecture et de l'écriture de qdatastream
Global and Chinese market of protection circuit modules 2022-2028: Research Report on technology, participants, trends, market size and share
积分商城游戏能够给商家带来什么?怎么搭建积分商城?
Common methods in transforms
Query long transaction
The longest increasing subsequence and its optimal solution, total animal weight problem
Pytoch (II) -- activation function, loss function and its gradient
