当前位置:网站首页>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
}
},
边栏推荐
- [EF core] mapping relationship between EF core and C data type
- Rasa 3.x 学习系列-Rasa 3.2.1 新版本发布
- GFS distributed file system
- Go language implementation principle -- map implementation principle
- PADS ROUTER 使用技巧小记
- 证明 poj 1014 模优化修剪,部分递归 有错误
- TVS管 与 稳压二极管参数对比
- [original] what is the core of programmer team management?
- Huawei simulator ENSP - hcip - MPLS experiment
- 98. 验证二叉搜索树 ●●
猜你喜欢
零犀科技携手集智俱乐部:“因果派”论坛成功举办,“因果革命”带来下一代可信AI
Rasa 3.x 学习系列-Rasa 3.2.1 新版本发布
Technical specifications and model selection guidelines for TVs tubes and ESD tubes - recommended by jialichuang
Brushless drive design -- on MOS drive circuit
Comparison of parameters between TVs tube and zener diode
Use mapper: --- tkmapper
Redis高可用——主从复制、哨兵模式、集群
进击的技术er——自动化
Do you regret becoming a programmer?
【LeetCode】5. Valid Palindrome·有效回文
随机推荐
(4) UART application design and simulation verification 2 - RX module design (stateless machine)
Object detection based on impulse neural network
[original] what is the core of programmer team management?
Cwaitabletimer timer, used to create timer object access
rsync远程同步
4 points tell you the advantages of the combination of real-time chat and chat robots
When to use useImperativeHandle, useLayoutEffect, and useDebugValue
98. 验证二叉搜索树 ●●
20220703 week race: number of people who know the secret - dynamic rules (problem solution)
Neural structured learning 4 antagonistic learning for image classification
Dynamic planning: robbing families and houses
424. 替换后的最长重复字符 ●●
【经典控制理论】自控实验总结
5. Logistic regression
Creative mode 1 - single case mode
无刷驱动设计——浅谈MOS驱动电路
Xinyuan & Lichuang EDA training camp - brushless motor drive
Data analysis - Thinking foreshadowing
Rethinking about MySQL query optimization
11gR2 Database Services for &quot; Policy&quot; and &quot; Administrator&quot; Managed databases (file I