要为select设定默认值,有两个步骤
1、数据中,声明一个变量param;该变量的值设为你想设定的select option中value
2、控件的 v-model 绑定 param 即可
<div id="app">
<template>
<el-select v-model="value4" clearable placeholder="请选择">
<el-option v-for="item in options" :label="item.label" :value="item.value">
</el-option>
</el-select>
</template>
</div>
var Main = {
data() {
return {
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
value4: '选项2'
}
}
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
代码摘自:https://segmentfault.com/q/1010000008962854