当前位置:网站首页>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
边栏推荐
- Design of kindergarten real-time monitoring and control system
- Traditional chips and AI chips
- Introduce reflow & repaint, and how to optimize it?
- Bumblebee: build, deliver, and run ebpf programs smoothly like silk
- Kotlin - 协程 Coroutine
- spoon插入更新oracle数据库,插了一部分提示报错Assertion botch: negative time
- Azkaban概述
- openresty ngx_lua变量操作
- 返回二叉树中两个节点的最低公共祖先
- Hmi-31- [motion mode] solve the problem of picture display of music module
猜你喜欢
TCP security of network security foundation
Yyds dry goods inventory intelligent fan based on CC2530 design
Elfk deployment
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience
Hmi-31- [motion mode] solve the problem of picture display of music module
Application and Optimization Practice of redis in vivo push platform
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
【LeetCode】98. Verify the binary search tree (2 brushes of wrong questions)
随机推荐
Character painting, I use characters to draw a Bing Dwen Dwen
Problem solving: attributeerror: 'nonetype' object has no attribute 'append‘
Day_ 17 IO stream file class
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Vb+access hotel service management system
Hmi-30- [motion mode] the module on the right side of the instrument starts to write
Serious bugs with lifted/nullable conversions from int, allowing conversion from decimal
Zabbix
Naacl 2021 | contrastive learning sweeping text clustering task
[Yu Yue education] National Open University spring 2019 0505-22t basic nursing reference questions
LeetCode 314. Binary tree vertical order traversal - Binary Tree Series Question 6
单项框 复选框
Avoid material "minefields"! Play with super high conversion rate
Elfk deployment
[source code attached] Intelligent Recommendation System Based on knowledge map -sylvie rabbit
el-select,el-option下拉选择框
From task Run get return value - getting return value from task Run
[download white paper] does your customer relationship management (CRM) really "manage" customers?
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
Azkaban安装部署