当前位置:网站首页>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
边栏推荐
- BaseRecyclerViewAdapterHelper 实现下拉刷新和上拉加载
- STM32控制步进电机(ULN2003+28byj)
- Unable to create servlet under SRC subfile of idea
- [Blue Bridge Cup] April 17 provincial competition brushing training (the first three questions)
- BUUCTF WEB [BJDCTF2020]ZJCTF,不过如此
- leetcode-791. 自定义字符串排序
- Pre competition practice of TIANTI competition
- Remote sensing image classification and recognition system based on convolutional neural network
- unity常见的问题(一)
- Try the server for one month for free, and attach the tutorial
猜你喜欢
STM32 is connected to the motor drive, the DuPont line supplies power, and then the back burning problem
STM32控制步进电机(ULN2003+28byj)
使用Source Insight查看编辑源代码
世界读书日:我想推荐这几本书
Image attribute of input: type attribute of fashion cloud learning -h5
Trier les principales utilisations de l'Agent IP réseau
航芯技术分享 | ACM32 MCU安全特性概述
box-sizing
Resolve disagrees about version of symbol device_ create
STM32 project transplantation: transplantation between chip projects of different models: Ze to C8
随机推荐
21 天学习MongoDB笔记
NPDP|产品经理如何做到不会被程序员排斥?
Can I take the CPDA data analyst certificate for 0 foundation
BUUCTF WEB [GXYCTF2019]禁止套娃
8 websites that should be known for product development to enhance work experience
Calculate the past date and days online, and calculate the number of live days
What are the forms of attack and tampering on the home page of the website
SynchronousQueue 源码解析
Message queuing overview
0基础可以考CPDA数据分析师证书吗
解锁OpenHarmony技术日!年度盛会,即将揭幕!
Deploying MySQL in cloud native kubesphere
STM32工程移植:不同型号芯片工程之间的移植:ZE到C8
免费试用一个月的服务器,并附上教程
Introduction to servlet listener & filter
SSM框架系列——注解开发day2-2
AD20补充笔记3—快捷键+持续更新
在线计算过往日期天数,计算活了多少天
Kubernetes 入門教程
Markdown grammar learning