当前位置:网站首页>The submenu of the el-cascader cascade selector is double-clicked to display the selected content
The submenu of the el-cascader cascade selector is double-clicked to display the selected content
2022-08-10 05:49:00 【Why can't I get enough to eat?】

Recently encountered such a mistake, the submenu needs to be clicked twice before its value is displayed in the selector bar, and one click can get the value, but it is not displayed. The code is as follows:

It should be noted here that by binding the listening option switching event @change="handleChange" to the cascading selector, when we switch options, we can get the selected options from the first level to the following methods in this method.All value arrays of the last level,
Example: The array of cascade selectors is as follows
{
partKey:'a',
partName:'First-level equipment',
children:[
{
PartKey:'a1',
PartName:'Secondary device 1',
},
partKey:'a2',
partName:'Secondary device 2',}
]
}// The secondary device 2 is selected at this time
Then this.checkedAllValue=['a','a2']
// The nodeName here is the ref attribute defined in the cascade selector, and checkedValue is the method of refs itself, just use it directlythis.checkedAllValue = this.$refs["nodeName"].checkedValue;But we only use the value of the currently selected level in the end, so it is changed to the following, Remember to define the variable in data!
this.checkedPartKey = this.$refs["nodeName"].checkedValue[1];Then traverse the array bound by the current cascade selector in the handleChange method, and use the forEach() method to match the currently selected checkedPartKey with the partKey of each item in the array.The partName of an item is assigned to the checkedPartName defined in data, and it is assigned to partName when the form is finally submitted, so that the partName carried when sending the request is the partName value of the selected option submenu in the array of the above example.
If you don't do this, and write this.dataForm.partName as the others when sending the request, the passed value is an array. I can't remember the passed value, but it doesn't meet the requirements.
p>// Listen for the event that the cascading selector option changeshandleChange() {this.checkedPartKey = this.$refs["nodeName"].checkedValue[1];this.nodeNameOptions.forEach((item, index, nodeNameOptions) => {let itemArr = item.children;itemArr.forEach((item1, index, itemArr) => {if (this.checkedPartKey == item1.partKey) {this.checkedPartName = item1.partName;}});});},-----------------------------------------------------------------------------------------------------------------------------------------
I suddenly thought that instead of defining the variable checkedPartName, you can directly make this.dataForm.partName=partName of the matching item after matching it.

边栏推荐
- 图纸怎么折?(A0,A1,A2,A3の图纸如何折成A4大小)
- 第二次实验
- sqlplus 显示上一条命令及可用退格键
- The latest and most complete digital collection sales calendar-07.27
- shell脚本中利用sqlplus操作数据库
- 图片批量添加水印批量加背景缩放批量合并工具picUnionV4.0
- Chain Reading | The latest and most complete digital collection calendar-07.28
- 泛型笔记()()()
- win12 modify dns script
- Content related to ZigBee network devices
猜你喜欢

深度学习中数据到底要不要归一化?实测数据来说明!

Multi-table query Notes

Batch add watermark to pictures batch add background zoom batch merge tool picUnionV4.0

图片批量添加水印批量加背景缩放批量合并工具picUnionV4.0

Reflection 【Notes】

PCL,VS配置过程中出现:用 _sopen_s 代替 _open, 或用_CRT_SECURE_NO_WARNNINGS错误

Link reading good article: What is the difference between hot encrypted storage and cold encrypted storage?

Chain Reading Good Article: Jeff Garzik Launches Web3 Production Company

链读|最新最全的数字藏品发售日历-08.02

利用PyQt5制作YOLOv5的GUI界面
随机推荐
非会员更改有道云笔记背景
Link reading good article: What is the difference between hot encrypted storage and cold encrypted storage?
小程序学习笔记:小程序组件间通信方式
训练集Loss收敛,但是测试集Loss震荡的厉害?
最新最全的数字藏品发售日历-07.27
链读精选:星巴克着眼于数字收藏品并更好地吸引客户
matlab中的常用的类型转换
latex图片排版技巧总结
链读 | 最新最全的数字藏品发售日历-07.28
impdp import data
Database Notes Create Database, Table Backup
你不知道的常规流
笔记1
三维点云分割
Knowledge Distillation Thesis Learning
Set Sources Resources and other folders in the IDEA project
The complex "metaverse" will be interpreted for you, and the Link Reading APP will be launched soon!
Batch add watermark to pictures batch scale pictures to specified size
shell脚本中利用sqlplus操作数据库
cesium 旋转图片