当前位置:网站首页>V-model binding value in El select, data echo only displays value, not label
V-model binding value in El select, data echo only displays value, not label
2022-04-23 12:53:00 【ZMJ_ QQ】
1、 When v-model When a value is bound
<el-select v-model="modelTree" filterable>
<el-option v-for="item in nameList" :key="item.id" :label="item.title" :value="item.id">
</el-option>
</el-select>
The data echo shows only value, No display label, There may be several reasons :
1、option The... Does not exist in the data of value value ,
2、option Of value Values and v-model The value of the binding , Inconsistent data types ,console.log Print out whether the two data types are consistent , In case of inconsistency, just change to the corresponding type .
3、 If the data is echoed , Show first value Display after value label value , It's because the page option The data of the drop-down box has not been obtained yet , So first show value value , You can add a... To the page loading
2、 When v-model When an object is bound
<el-select v-model="user" value-key="id" >
<el-option
v-for="item in users"
:key="item.id"
:label="item.name"
:value="item"
/>
</el-select>
1、value-key Bound property value Whether and :key The values of the objects bound in are equal
value-key="id"
:key="item.id"
2、v-model The bound value needs to be an object , And this object must contain value-key Properties bound in
版权声明
本文为[ZMJ_ QQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230616457271.html
边栏推荐
- Unlock openharmony technology day! The annual event is about to open!
- 31. 下一个排列
- SSM framework series - data source configuration day2-1
- 将新增和编辑的数据同步更新到列表
- AD20补充笔记3—快捷键+持续更新
- [csnote] ER diagram
- 风尚云网学习-h5的input:type属性的image属性
- The accuracy and speed are perfectly balanced, and the latest image segmentation SOTA model is released!!!
- No idle servers? Import OVF image to quickly experience smartx super fusion community version
- Uni app native app local packaging integrated Aurora push (jg-jpush) detailed tutorial
猜你喜欢
世界读书日:我想推荐这几本书
【vulnhub靶场】-dc2
Softbank vision fund entered the Web3 security industry and led a new round of investment of US $60 million in certik
基于卷积神经网络的遥感影像分类识别系统
Wonderful review | the sixth issue of "source" - open source economy and industrial investment
将新增和编辑的数据同步更新到列表
Deploying MySQL in cloud native kubesphere
数据库中的日期时间类型
产品开发都应该知道的8个网站,增强工作体验
NPDP | how can product managers not be excluded by programmers?
随机推荐
SSM框架系列——注解开发day2-2
【蓝桥杯】4月17日省赛刷题训练(前3道题)
Kubernetes 入門教程
SSM框架系列——数据源配置day2-1
数据库中的日期时间类型
C#,二维贝塞尔拟合曲线(Bézier Curve)参数点的计算代码
21 days learning mongodb notes
leetcode:437. Path sum III [DFS selected or not selected?]
31. Next arrangement
BaseRecyclerViewAdapterHelper 实现下拉刷新和上拉加载
PHP generates JSON to process Chinese
大家帮我看一下这是啥情况,MySQL5.5的。谢了
Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]
4. DRF permission & access frequency & filtering & sorting
【csnote】ER图
进程虚拟地址空间区域划分
RT-thread中关键词解释及部分API
实现一个盒子在父盒子中水平垂直居中的几种“姿势”
使用Source Insight查看编辑源代码
Redis deployment of cloud native kubesphere