Open tiantingrui opened 2 years ago
方法一: 使用 v-if 的特性(销毁并且重绘)可以强制刷新子组件
v-if
<el-table-column label="启停"> <template #default="scope"> <disabled-switch v-if="forceRefresh" :value="scope.row.allowWarn" /> </template> </el-table-column> async getTableData() { this.loading = true this.forceRefresh = false const params = { pageNum: this.pageNum, pageSize: this.pageSize } const rst = await this.$api.riskControlCenter.getAlarmSettingsList(params) this.loading = false const { list, totalCount } = rst this.tableData = [...list] this.total = totalCount this.$nextTick(() => { this.forceRefresh = true }) },
方法二: 使用this.$forceUpdate强制重新渲染
方法一: 使用
v-if
的特性(销毁并且重绘)可以强制刷新子组件