VUE select元素动态的从后台获取到
-
<el-form-item label="选择店铺">
<el-select v-model="value" placeholder="请选择店铺">
<el-option
v-for="item in storeInfoList"
:key="item.storeId"
:label="item.storeName"
:value="item.storeId">
</el-option>
</el-select>
</el-form-item>
export default {
name: "CouponOpen",
data() {
return {
storeInfoList: ‘‘
}
},
mounted() {
let _this = this
axios({
method: ‘get‘,
url: ‘http://localhost:1111/waimai/store/selectStoreIdAndName‘
}).then(function (res) {
_this.storeInfoList = res.data
})
},
methods: {
onSubmit() {
console.log(‘submit!‘);
}
}
}
</script>
<style scoped>
</style>
-
vue+element UI 使用select元素动态的从后台获取到