当前位置:网站首页>The use of El cascader and the solution of error reporting
The use of El cascader and the solution of error reporting
2022-07-05 23:42:00 【SwJieJie】
Problem description :
scene : Some types have no data , At this time cascader Of options yes [ ], The drop-down box is empty . If you choose a type , Get cascader The data of , stay cascader Select a piece of data , Replacement type , If there is no such data, an error will be reported
This is in use element ui Medium cascader Error reports that appear
The reason is not clear for the time being , Personal understanding may be that the data source has not been updated in time , and vue It's data driven , So I added a monitor , And give cascader Bind a key, In this way, as long as the data source changes ,key Just change , Just re render
terms of settlement 1:
If there is no data, it will cascader Set to non editable
<el-cascader
:options="cascaderOption"
:props="props"
:disabled="optionsChanged"
v-model="cascaderValue"
collapse-tags
:placeholder="showPlaceholder"
/>
And directly return, Do not load drop-down nodes
getCascader() {
this.cascaderValue= []
getCascader(this.type).then(response => {
if(response.data.data.length === 0){
this.optionsChanged = true
this.showPlaceholder = ' No scope temporarily '
return
}
this.cascaderOption = response.data.data
});
}
terms of settlement 2: By binding unique key,key Just change , Just re render
<el-cascader
:key="keyValue" //keyValue stay data In the definition of , The initial value is 0
clearable
:props="propsObj"
v-model="value"
:options="options"
>
</el-cascader>
watch: {
options(newVal) {
this.keyValue++ // As long as the data source changes , change keyValue Value , To achieve the effect of re rendering
}
},
边栏推荐
- Xinyuan & Lichuang EDA training camp - brushless motor drive
- (4) UART application design and simulation verification 2 - RX module design (stateless machine)
- 证明 poj 1014 模优化修剪,部分递归 有错误
- 21. PWM application programming
- asp. Net pop-up layer instance
- Fiddler Everywhere 3.2.1 Crack
- 俄外交部:日韩参加北约峰会影响亚洲安全稳定
- [SQL] SQL expansion languages of mainstream databases (T-SQL, pl/sql, pl/pgsql)
- 2022.6.20-6.26 AI行业周刊(第103期):新的小生命
- Object detection based on impulse neural network
猜你喜欢
Use mapper: --- tkmapper
STM32__06—单通道ADC
GFS分布式文件系統
98. 验证二叉搜索树 ●●
Pyqt control part (I)
20. Migrate freetype font library
零犀科技携手集智俱乐部:“因果派”论坛成功举办,“因果革命”带来下一代可信AI
Initial experience | purchase and activate typora software
Bao Yan notebook IV software engineering and calculation volume II (Chapter 8-12)
SpreadJS 15.1 CN 与 SpreadJS 15.1 EN
随机推荐
VS2010编写动态链接库DLL和单元测试,转让DLL测试的正确性
Spire.PDF for NET 8.7.2
Design and implementation of secsha system
JVM的简介
Common static methods of math class
The interface of grafana tool displays an error, incluxdb error
698. Divided into k equal subsets ●●
Cwaitabletimer timer, used to create timer object access
Online yaml to CSV tool
如何让同步/刷新的图标(el-icon-refresh)旋转起来
Attacking technology Er - Automation
开源crm客户关系统管理系统源码,免费分享
There are 14 God note taking methods. Just choose one move to improve your learning and work efficiency by 100 times!
How to design API return code (error code)?
Opencvsharp (C openCV) shape detection and recognition (with source code)
UVA11294-Wedding(2-SAT)
Spécifications techniques et lignes directrices pour la sélection des tubes TVS et ESD - Recommandation de jialichuang
How to enable relationship view in phpMyAdmin - how to enable relationship view in phpMyAdmin
Comparison between webgl and webgpu [3] - vertex buffer
Object detection based on impulse neural network