当前位置:网站首页>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]
}

此时就可以默认显示啦
边栏推荐
- Online incremental migration of DM database
- Mysql database learning
- 2022阿里巴巴全球数学竞赛 第4题 虎虎生威(盲盒问题、集卡问题)解决思路
- C# 基于MQTTNet的服务端与客户端通信案例
- Application d'un robot intelligent dans le domaine de l'agroécologie
- Rhcsa --- work on the fourth day
- Knowledge arrangement about steam Education
- Starting from the classification of database, I understand the map database
- 正大美欧4的主账户关注什么数据?
- ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
猜你喜欢

LeetCode-对链表进行插入排序

农业生态领域智能机器人的应用

Cultivate primary and secondary school students' love for educational robots

Embedded-c language-9-makefile/ structure / Consortium

Precipitate yourself and stay up late to sort out 100 knowledge points of interface testing professional literacy

How do I interview for a successful software testing position? If you want to get a high salary, you must see the offer

关于Steam 教育的知识整理

Mysql database learning

Video multiple effects production, fade in effect and border background are added at the same time

Line by line explanation of yolox source code of anchor free series network (7) -- obj in head_ loss、Cls_ Loss and reg_ Calculation and reverse transmission of loss I
随机推荐
06 装饰(Decorator)模式
Fasttext text text classification
Embedded-c language-8-character pointer array / large program implementation
解析少儿编程中的动手搭建教程
農業生態領域智能機器人的應用
Markdown edit syntax
National all Chinese Automatic Test Software apifox
Promise all()
Leetcode merge sort linked list
GeoTrust ov multi domain SSL certificate is 2100 yuan a year. How many domain names does it contain?
Save the CDA from the disc to the computer
面试会问的 Promise.all()
ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
Several methods of capturing packets under CS framework
Practical problem solving ability of steam Education
洛谷入门3【循环结构】题单题解
Idea automatic package import and automatic package deletion settings
Research on the security of ognl and El expressions and memory horse
Federal learning: dividing non IID samples according to Dirichlet distribution
Use of typescript classes