data(){ return { searchData:{ code:'', name:'', pageIndex: 1, pageSize: 10 }, searchParams:{}, } }
一、数据清除:
//方式一 this.search = Object.assign(this.$data.search, this.$options.data().search); //方式二 this.search = this.$options.data().search;
二、数据拷贝:
//方式一 this.searchParams = JSON.parse(JSON.stringify(this.search)); //方式二 this.searchParams = Object.assign({},this.search, this.searchParams);