当前位置:网站首页>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
边栏推荐
- Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 1)
- Yyds dry goods inventory intelligent fan based on CC2530 design
- Unpool(nn.MaxUnpool2d)
- openresty ngx_ Lua execution phase
- Icu4c 70 source code download and compilation (win10, vs2022)
- Design and implementation of community hospital information system
- Naacl 2021 | contrastive learning sweeping text clustering task
- Exploration of short text analysis in the field of medical and health (I)
- el-select,el-option下拉选择框
- Moco V2 literature research [self supervised learning]
猜你喜欢

Sqoop安装

1.五层网络模型
![Moco V2 literature research [self supervised learning]](/img/bd/79b7b203ea064c65d143116c9f4dd0.jpg)
Moco V2 literature research [self supervised learning]

Devtools的简单使用
![ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience](/img/22/08617736a8b943bc9c254aac60c8cb.jpg)
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience

Linux安装Redis
![[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?

Apache Web page security optimization

Elfk deployment
![[technology development-26]: data security of new information and communication networks](/img/13/10c8bd340017c6516edef41cd3bf6f.png)
[technology development-26]: data security of new information and communication networks
随机推荐
ASP. Net core 6 framework unveiling example demonstration [01]: initial programming experience
单项框 复选框
[機緣參悟-38]:鬼穀子-第五飛箝篇 - 警示之一:有一種殺稱為“捧殺”
Tiny series rendering tutorial
Design and implementation of campus epidemic prevention and control system based on SSM
Blue bridge - maximum common divisor and minimum common multiple
Using druid to connect to MySQL database reports the wrong type
Idea inheritance relationship
[daily problem insight] Li Kou - the 280th weekly match (I really didn't know it could be so simple to solve other people's problems)
College Students' innovation project management system
【LeetCode】106. Construct binary tree from middle order and post order traversal sequence (wrong question 2)
PHP cli getting input from user and then dumping into variable possible?
Serious bugs with lifted/nullable conversions from int, allowing conversion from decimal
Can you really learn 3DMAX modeling by self-study?
看 TDengine 社区英雄线上发布会,听 TD Hero 聊开发者传奇故事
Design of KTV intelligent dimming system based on MCU
Sqoop命令
Watch the online press conference of tdengine community heroes and listen to TD hero talk about the legend of developers
Use the difference between "Chmod a + X" and "Chmod 755" [closed] - difference between using "Chmod a + X" and "Chmod 755" [closed]
Bumblebee: build, deliver, and run ebpf programs smoothly like silk