created():在创建vue对象时,当html渲染之前就触发;但是注意,全局vue.js不强制刷新或者重启时只创建一次,也就是说,created()只会触发一次;
activated():在vue对象存活的情况下,进入当前存在activated()函数的页面时,一进入页面就触发;可用于初始化页面数据等。
// 获取列表数据
getTeamTree(val) {
this.treeLoading = true;
this.$http.position
.positionTree({
params: {
name: val,
},
})
.then(({ data }) => {
this.treeLoading = false;
this.TreeData = data;
});
},
// 分页查询
getPageList() {
this.loading = true;
this.$http.position
.positionPage({
params: this.formInline,
})
.then(({ data, code, msg }) => {
this.dataInfo = data;
this.total = data.total;
this.loading = false;
});
},
//插入数据后自动刷新
activated() {
this.getTeamTree();
this.getPageList();
},版权声明:本文为qq_57528681原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。