vue|vue 路由强制刷新页面最简单方法
场景
切换导航用户/组织id后,i需要刷新所在页面。
ctrl+f5/window.reload会页面刷新,但可以vue内部实现。
文章图片
image.png 【vue|vue 路由强制刷新页面最简单方法】1空白页
2 引入公共head所在跳转页
methods:{
changeOrg(item) {
//设置本地
localStorage.setItem('curOrg', item.id)
//执行store有时没触发
this.$store.dispatch('update',JSON.parse(JSON.stringify(item)))
//跳转其他页面再返回
this.$router.push({
name:'back',
params:{
link:this.$route.path//当前路由
}
})
},}
route.js
{
//全局刷新
path: '/back',
name: 'back',
component: () =>
import ('@/views/空白页'),
}
参考资料
https://blog.csdn.net/qq_16772725/article/details/80467492
推荐阅读
- vue-cli|vue-cli 3.x vue.config.js 配置
- 2020-04-07vue中Axios的封装和API接口的管理
- VueX--VUE核心插件
- vue组件中为何data必须是一个函数()
- 用npm发布一个包的教程并编写一个vue的插件发布
- vuex|vuex 基础结构
- Vue源码分析—响应式原理(二)
- VueX(Vuex|VueX(Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式)
- vue中的条件判断详解v-if|vue中的条件判断详解v-if v-else v-else-if v-show
- 如何在手机上查看测试vue-cli构建的项目