去掉this.$set语法(语法报错),在3.0已废弃,用 proxy 实现双向绑定不会出现不更新的问题
parent
4dd1b4aae6
commit
8c1b5ce574
|
@ -110,14 +110,14 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchData } from "../api/index";
|
||||
import { fetchData } from '../api/index';
|
||||
export default {
|
||||
name: "basetable",
|
||||
name: 'basetable',
|
||||
data() {
|
||||
return {
|
||||
query: {
|
||||
address: "",
|
||||
name: "",
|
||||
address: '',
|
||||
name: '',
|
||||
pageIndex: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
|
@ -145,17 +145,18 @@ export default {
|
|||
},
|
||||
// 触发搜索按钮
|
||||
handleSearch() {
|
||||
this.$set(this.query, "pageIndex", 1);
|
||||
// this.$set(this.query, "pageIndex", 1); // this.$set在3.0已废弃。用 proxy 实现双向绑定不会出现不更新的问题
|
||||
this.query.pageIndex = 1;
|
||||
this.getData();
|
||||
},
|
||||
// 删除操作
|
||||
handleDelete(index) {
|
||||
// 二次确认删除
|
||||
this.$confirm("确定要删除吗?", "提示", {
|
||||
type: "warning"
|
||||
this.$confirm('确定要删除吗?', '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$message.success("删除成功");
|
||||
this.$message.success('删除成功');
|
||||
this.tableData.splice(index, 1);
|
||||
})
|
||||
.catch(() => {});
|
||||
|
@ -166,10 +167,10 @@ export default {
|
|||
},
|
||||
delAllSelection() {
|
||||
const length = this.multipleSelection.length;
|
||||
let str = "";
|
||||
let str = '';
|
||||
this.delList = this.delList.concat(this.multipleSelection);
|
||||
for (let i = 0; i < length; i++) {
|
||||
str += this.multipleSelection[i].name + " ";
|
||||
str += this.multipleSelection[i].name + ' ';
|
||||
}
|
||||
this.$message.error(`删除了${str}`);
|
||||
this.multipleSelection = [];
|
||||
|
@ -184,11 +185,13 @@ export default {
|
|||
saveEdit() {
|
||||
this.editVisible = false;
|
||||
this.$message.success(`修改第 ${this.idx + 1} 行成功`);
|
||||
this.$set(this.tableData, this.idx, this.form);
|
||||
// this.$set(this.tableData, this.idx, this.form);
|
||||
this.tableData[this.idx] = this.form;
|
||||
},
|
||||
// 分页导航
|
||||
handlePageChange(val) {
|
||||
this.$set(this.query, "pageIndex", val);
|
||||
// this.$set(this.query, "pageIndex", val);
|
||||
this.query.pageIndex = val;
|
||||
this.getData();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue