詳情頁面 路由上帶了參數並賦值展示成功,
這個由路由上帶的參數修改時,頁面沒渲染,值已改變,
如果此時去做別的不是路由賦值的參數修改,前面做的修改就刷新出來渲染成功
原代碼
this.crud.query.bankId =""; this.crud.query.batchNo =""; this.$nextTick(() => { this.crud.data = []; if (this.$route.query.bankId) { // this.crud.query.bankId = this.$route.query.bankId + ""; this.$set(this.query, "bankId", this.$route.query.bankId + ""); } if (this.$route.query.batchNo) { // this.crud.query.batchNo = this.$route.query.batchNo; this.$set(this.query, "batchNo", this.$route.query.batchNo); } this.crud.toQuery(); });
經過長久測試
發現這樣就可以了emmmm
this.$set(this.crud.query, "bankId", ""); this.$set(this.crud.query, "batchNo", ""); this.$nextTick(() => { this.crud.data = []; if (this.$route.query.bankId) { this.crud.query.bankId = this.$route.query.bankId + ""; // this.$set(this.query, "bankId", this.$route.query.bankId + ""); } if (this.$route.query.batchNo) { this.crud.query.batchNo = this.$route.query.batchNo; } this.crud.toQuery(); });