AntD Select 选择器设置默认选中项
程序员文章站
2022-03-07 21:39:01
没什么可说的直接放代码:default-value="{ key: defaultSheet }"
没什么可说的直接放代码
- :default-value="{ key: defaultSheet }"
<template>
<div class="wrapper">
<a-select
:default-value="{ key: defaultSheet }"
class="new-from-preview-title-item"
label-in-value
style="width: 120px"
@change="onSelectSheet"
>
<a-select-option v-for="(item,index) in file.sheetList" :key="index" :value="index">{{ item }}</a-select-option>
</a-select>
</div>
</template>
<script>
export default {
data() {
return {
file: {
sheetList: ['sheet1', 'sheet2','sheet3']
},
defaultSheet: 0
}
},
methods: {
onSelectSheet(val) {
console.log(val)
}
}
}
</script>
本文地址:https://blog.csdn.net/zxBlogs/article/details/107394824