当前位置:网站首页>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
边栏推荐
- Which common ports should the server open
- Blue bridge - maximum common divisor and minimum common multiple
- el-select,el-option下拉选择框
- Voice chip wt2003h4 B008 single chip to realize the quick design of intelligent doorbell scheme
- Avoid material "minefields"! Play with super high conversion rate
- Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 1)
- this+闭包+作用域 面试题
- Openresty ngx Lua Execution stage
- Bumblebee: build, deliver, and run ebpf programs smoothly like silk
- CAM Pytorch
猜你喜欢
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
[download white paper] does your customer relationship management (CRM) really "manage" customers?
Zabbix
qrcode:将文本生成二维码
2021 Li Hongyi machine learning (3): what if neural network training fails
Open source SPL optimized report application coping endlessly
openresty ngx_ Lua execution phase
Moco V2 literature research [self supervised learning]
Acwing game 58 [End]
Practical case of SQL optimization: speed up your database
随机推荐
Uniapp navigateto jump failure
2022/02/13
Azkaban实战
Design of kindergarten real-time monitoring and control system
Yyds dry goods inventory intelligent fan based on CC2530 design
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Naacl 2021 | contrastive learning sweeping text clustering task
Good documentation
Leetcode takes out the least number of magic beans
tuple and point
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
腾讯云,实现图片上传
Azkaban概述
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
Linux安装Redis
打破信息茧房-我主动获取信息的方法 -#3
openresty ngx_lua变量操作
Design and practice of kubernetes cluster and application monitoring scheme
Summary and practice of knowledge map construction technology