const supplierIdcolumns=reactive([])
const getsupplierId=()=>{
supplierIdcolumns=[]
let params={type:'1'};
$http.post('/trans/supplier/querySupplier',qs.stringify(params)).then((res)=>{
if(res.code=='00000'){
supplierIdcolumns=res.data
}else{
Toast.fail(res.codeMsg)
}
})
}
刚开始代码这样写的 发现绑不不上去值
然而 vue3是使用proxy 对于对象和数组不能直接整个赋值;
所以外面包一层 解决问题:
const state = reactive({
supplierIdcolumns: [],
});
const getsupplierId=()=>{
state.supplierIdcolumns=[]
let params={type:'1'};
$http.post('/trans/supplier/querySupplier',qs.stringify(params)).then((res)=>{
if(res.code=='00000'){
state.supplierIdcolumns=res.data
}else{
Toast.fail(res.codeMsg)
}
})
}