没什么可说的直接放代码
- :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>