<Select v-model="AllproductsCode" placeholder="所有产品" style="width:150px" @on-change="AllproductsChange" class="mr20 ml50">
<Option v-for="item in AllproductsList" :value="item.productCode" :key="item.productCode">{{ item.productName }}
</Option>
</Select>
exportdefault{
data(){
retrun{
AllproductsCode:"code",
AllproductsList:[]
}
},
methods:{
AllproductsChange(value){
this.AllproductsCode= value
}
},
created() {
// 所有产品
this.http
.post(BASE_URL + "请求路径", {})
.then(data => {
if (data.code == "success") {
this.AllproductsList = data.data;
this.AllproductsList.splice(0,0,{ productCode: "code", productName: "所有产品" })
}
})
.catch(err => {
console.log(err);
});
},
}