当前位置:网站首页>el-cascader回显只选中不显示的问题
el-cascader回显只选中不显示的问题
2022-07-02 04:58:00 【走出自闭的鸟儿】
el-cascader回显只选中不显示的问题
先看代码
<el-cascader
:options="cityData"
v-model="cityCascader"
@change="handleChange"
class="w500">
</el-cascader>
因为el-cascader的v-model绑定的必须是数组
所以在我点击对应页面发起请求的时候,将需要的值push到cityCascader中
// 点击获取到数据后,将数据push到级联中用于默认显示
if(this.form.province != ""){
this.cityCascader.push(this.form.province)
}
this.cityCascader.push(this.form.city)
this.cityCascader.push(this.form.district)
此时就会出现标题的问题,我的cityCascader的数据是符合要求的,但是级联选择框没有默认数据,只有默认选中
解决方法是,不使用数组的push方法,而是直接重新赋值
if(this.form.province != ""){
this.cityCascader = [this.form.province,this.form.city,this.form.district]
}else{
this.cityCascader = [this.form.city,this.form.district]
}
此时就可以默认显示啦
边栏推荐
- About PROFIBUS: communication backbone network of production plant
- 汇编语言中的标志位:CF、PF、AF、ZF、SF、TF、IF、DF、OF
- Idea automatic package import and automatic package deletion settings
- 06 decorator mode
- Flag bits in assembly language: CF, PF, AF, ZF, SF, TF, if, DF, of
- Acelems Expressway microgrid energy efficiency management platform and intelligent lighting solution intelligent lighting tunnel
- Case sharing | intelligent Western Airport
- Interview question: do you know the difference between deep copy and shallow copy? What is a reference copy?
- 面试会问的 Promise.all()
- Several methods of capturing packets under CS framework
猜你喜欢
How to recover deleted data in disk
How to write a client-side technical solution
Mapping location after kotlin confusion
LeetCode-归并排序链表
Getting started with pytest -- description of fixture parameters
Mysql database learning
TypeScript函数详解
记录一次Unity 2020.3.31f1的bug
解析少儿编程中的动手搭建教程
Learn BeanShell before you dare to say you know JMeter
随机推荐
06 decorator mode
Summary of database problems
Oracle stored procedure and job task setting
Detailed process of DC-1 range construction and penetration practice (DC range Series)
Basic differences between Oracle and MySQL (entry level)
Knowledge arrangement about steam Education
geotrust ov多域名ssl证书一年两千一百元包含几个域名?
Mathematical knowledge -- understanding and examples of fast power
数据库问题汇总
ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
Common errors of dmrman offline backup
How to configure PostgreSQL 12.9 to allow remote connections
记录一次Unity 2020.3.31f1的bug
解析少儿编程中的动手搭建教程
Embedded-c language-9-makefile/ structure / Consortium
June book news | 9 new books are listed, with a strong lineup and eyes closed!
Video cover image setting, put cover images into multiple videos in the simplest way
How to recover deleted data in disk
Vmware安装win10报错:operating system not found
6.30 year end summary, end of student age