当前位置:网站首页>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
}
},
边栏推荐
- GFS分布式文件系統
- Do you regret becoming a programmer?
- Brushless drive design -- on MOS drive circuit
- 2022.6.20-6.26 AI行业周刊(第103期):新的小生命
- golang代码检查工具
- Attacking technology Er - Automation
- 98. 验证二叉搜索树 ●●
- 有什么不起眼却挣钱的副业?
- VS2010 writes DLL and unit test of dynamic link library, and transfers the correctness of DLL test
- 如何获取localStorage中存储的所有值
猜你喜欢

Neural structured learning 4 antagonistic learning for image classification

如何获取localStorage中存储的所有值

芯源&立创EDA训练营——无刷电机驱动

Hcip course notes-16 VLAN, three-tier architecture, MPLS virtual private line configuration

保研笔记四 软件工程与计算卷二(8-12章)

Neural structured learning - Part 3: training with synthesized graphs

Initial experience | purchase and activate typora software

Rasa 3.x 学习系列-Rasa X 社区版(免费版) 更改

进击的技术er——自动化

20220703 周赛:知道秘密的人数-动规(题解)
随机推荐
Why use weak pointers for delegation- Why use weak pointer for delegation?
【经典控制理论】自控实验总结
UVA – 11637 garbage remembering exam (combination + possibility)
动态规划 之 打家劫舍
PADS ROUTER 使用技巧小记
QCombox(重写)+QCompleter(自动补全,自动加载qcombox的下拉选项,设置背景颜色)
Spécifications techniques et lignes directrices pour la sélection des tubes TVS et ESD - Recommandation de jialichuang
Tips for using pads router
CIS benchmark tool Kube bench
el-cascader的使用以及报错解决
Comparison of parameters between TVs tube and zener diode
Golang code checking tool
Pyqt control part (I)
Rasa 3.x 学习系列-Rasa 3.2.1 新版本发布
20220703 week race: number of people who know the secret - dynamic rules (problem solution)
2022.6.20-6.26 AI industry weekly (issue 103): new little life
698. Divided into k equal subsets ●●
保研笔记四 软件工程与计算卷二(8-12章)
It is proved that POJ 1014 module is optimized and pruned, and some recursion is wrong
Rasa 3.x 学习系列-Rasa X 社区版(免费版) 更改