当前位置:网站首页>El select, El option drop-down selection box
El select, El option drop-down selection box
2022-07-05 02:45:00 【13 less】
One . Use of drop-down selection box
<template>
<el-select v-model="value" placeholder=" Please select ">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
<script>
export default {
data() {
return {
options: [{
value: ' Options 1',
label: ' Golden cake '
}, {
value: ' Options 2',
label: ' Double skin milk '
}, {
value: ' Options 3',
label: ' Oyster omelet '
}, {
value: ' Options 4',
label: ' dragon whiskers noodles '
}, {
value: ' Options 5',
label: ' Beijing Roast Duck '
}],
value: ''
}
}
}
</script>Analysis of the code :
stay el-select Two way binding value value


stay el-option Cycle through

adopt V-for loop , loop options This array .
:key It is often used here when looping an array , Maximize rendering .
:label Label of options , If it is not set, it will be the same as value identical
View :

That is, pull it down to see .
:value The value of the option

verification :

Two . Practical application
<template>
<div class="">
{
{suibian}}
<el-select v-model="suibian">
<el-option v-for="(item,index) in arr" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</div>
</template>
<script>
export default {
data() {
return {
suibian:'',
arr:[
{
label:'1',
value:'1'
},
{
label:'2',
value:'2'
},
{
label:'3',
value:'3'
},
{
label:'5',
value:'5'
},
]
}
},
name: '',
methods: {
}
}
</script>
<style scoped>
</style>
3、 ... and . summary
1.key The binding is key Value in which diff Algorithm Maximize rendering
2. :label Associated with the selected item
3. :value Associated with the selected value
4.el-select adopt v-model The bound value is associated with the selected value , Can be an arbitrary value
边栏推荐
- Master Fur
- Apache build web host
- 使用druid連接MySQL數據庫報類型錯誤
- 8. Commodity management - commodity classification
- Yyds dry goods inventory intelligent fan based on CC2530 design
- Spoon inserts and updates the Oracle database, and some prompts are inserted with errors. Assertion botch: negative time
- Acwing第 58 场周赛【完结】
- Android advanced interview question record in 2022
- Zabbix
- Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
猜你喜欢
![[download white paper] does your customer relationship management (CRM) really](/img/e3/f130d071afb7309fdbf8a9c65b1d38.jpg)
[download white paper] does your customer relationship management (CRM) really "manage" customers?

ELK日志分析系统

Avoid material "minefields"! Play with super high conversion rate

看 TDengine 社区英雄线上发布会,听 TD Hero 聊开发者传奇故事

腾讯云,实现图片上传

Day_ 17 IO stream file class

spoon插入更新oracle数据库,插了一部分提示报错Assertion botch: negative time

Zabbix
![[source code attached] Intelligent Recommendation System Based on knowledge map -sylvie rabbit](/img/3e/ab14f3a0ddf31c7176629d891e44b4.png)
[source code attached] Intelligent Recommendation System Based on knowledge map -sylvie rabbit
![Hmi-31- [motion mode] solve the problem of picture display of music module](/img/9c/0b25c0a41758652848aed2a269880f.jpg)
Hmi-31- [motion mode] solve the problem of picture display of music module
随机推荐
When the low alcohol race track enters the reshuffle period, how can the new brand break the three major problems?
LeetCode --- 1071. Great common divisor of strings problem solving Report
Eight days of learning C language - while loop (embedded) (single chip microcomputer)
Azkaban概述
Pytest (5) - assertion
Uniapp navigateto jump failure
Flume配置4——自定义MYSQLSource
Bert fine tuning skills experiment
Asynchronous and promise
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
100 basic multiple choice questions of C language (with answers) 04
Leetcode takes out the least number of magic beans
PHP cli getting input from user and then dumping into variable possible?
Hmi-31- [motion mode] solve the problem of picture display of music module
腾讯云,实现图片上传
返回二叉树中两个节点的最低公共祖先
Avoid material "minefields"! Play with super high conversion rate
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
The most powerful new household god card of Bank of communications. Apply to earn 2100 yuan. Hurry up if you haven't applied!
【LeetCode】404. Sum of left leaves (2 brushes of wrong questions)