我有一个小的Vue应用程序,它有一个包含更多组件的父组件,最初我从数据库中获取一些产品数据,这些数据是通过Vue计算的数组中存储的。
我能做错什么?,在第一次结束时,我所做的是按照以下方式重置data(){}元素的值。
this.showModalOptions= false;
this.showModalType= false;
this.udpdateprecios = false;
this.products=[];
this.productsselect= [];
this.productselect={};
this.type= {};
this.obtenerProducts(); //get productos y assign to array products
所得产品法
obtenerProducts(){
axios.get('/api/products/all')
.then((result) => {
this.products= result.data.productos;
});
},
声明数据()
data() {
return {
products: [],
productselect: {},
type: {},
productsselect: [],
showModalOptions: false,
showModalType: false,
};
},
我不能添加一个对我有用的例子,也许这不是重置数组或对象的方法,它们停止反应?