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

此时就可以默认显示啦
边栏推荐
- Virtual machine installation deepin system
- 设置滚动条默认样式 谷歌浏览器
- VMware installation win10 reports an error: operating system not found
- Realize the function of data uploading
- Mouse events in JS
- Win10 disk management compressed volume cannot be started
- The underlying principle of go map (storage and capacity expansion)
- MySQL table insert Chinese change? Solution to the problem of No
- [common error] the DDR type of FPGA device is selected incorrectly
- win11安装pytorch-gpu遇到的坑
猜你喜欢

LM09丨费雪逆变换反转网格策略

Summary of common string processing functions in C language

DMA Porter

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

Analyzing the hands-on building tutorial in children's programming

Solution of DM database unable to open graphical interface

ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification

Getting started with pytest ----- confitest Application of PY

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

将光盘中的cda保存到电脑中
随机推荐
VMware installation win10 reports an error: operating system not found
Gin framework learning code
idea自动导包和自动删包设置
geotrust ov多域名ssl證書一年兩千一百元包含幾個域名?
CubeMx DMA笔记
Feign realizes file uploading and downloading
Lay the foundation for children's programming to become a basic discipline
Super detailed pycharm tutorial
Typescript function details
Go Chan's underlying principles
Record the bug of unity 2020.3.31f1 once
Oracle和MySQL的基本区别(入门级)
Steam教育的实际问题解决能力
Pit encountered in win11 pytorch GPU installation
Research on the security of ognl and El expressions and memory horse
Win10 disk management compressed volume cannot be started
geotrust ov多域名ssl证书一年两千一百元包含几个域名?
Summary of common string processing functions in C language
初学爬虫-笔趣阁爬虫
Embedded-c language-8-character pointer array / large program implementation