vue 刷新组件provide reload
文章目录
一 .vue 局部刷新组件
1.在app.vue 中这样定义
2.在子组件中引入, 使用的地方调用
inject:['reload'],
async agentCommit(){
if(this.$refs.tree.getCurrentNode() ){
await this.$store.dispatch("agentChange", this.$refs.tree.getCurrentNode());
this.reload(); //调接口回调后 刷新
}
},二: window.location.reload()浏览器全局刷新, 级页面重新加载
总结: 建议使用第一种方案, 它不会刷掉控制台中网络请求信息, 而第二种会
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论