vue this.$router.push 页面不刷新
解决办法:
使用 watch,观察路由,发生变化重新获取数据
<script>
export default {
data() {
return {
data: {}
}
},
methods: {
getData() {
// 获取数据方法
},
created() {
// 组件创建完后获取数据,
// 此时 data 已经被 observed 了
this.getData();
},
watch: {
// 如果路由发生变化,再次执行该方法
"$route": "getData"
}
}
</script>
vue this.$router.push 页面不刷新的更多相关文章
- vue中$router.push打开新窗口
在vue中使用 this.$router.push({ path: '/home' }) 默认是替代本窗口 如果想新开一个窗口,可以使用下面的方式: let routeData = this.$ro ...
- Vue this.$router.push、replace、go的区别
1.this.$router.push 描述:跳转到不同的url,但这个方法会向history添加一个记录,点击后会返回到上一个页面 用法 //字符串 this.$router.push('home' ...
- 简述在Js或Vue中监听页面的刷新、关闭操作
1.背景 大家是否经常遇到在关闭网页的时候,会看到一个确定是否离开当前页面的提示框?想一些在线测试系统.信息录入系统等就经常会有这一些提示,避免用户有意或者无意中关掉了页面,导致数据丢失.而最近在做项 ...
- vue this.$router.push query传递对象方法
this.$router.push({ path: '/home', query: { params: JSON.stringify({ name: 'lokka', age: 18 }) } }); ...
- vue this.$router.push和this.$route.path的区别
this.$router 实际上就是全局路由对象任何页面都可以调用 push(), go()等方法: this.$route 表示当前正在用于跳转的路由器对象,可以调用其name.path.quer ...
- Vue 路由切换时页面内容刷新页面并更新数据
第二次进入页面,页面路由参数已经改变,但是页面内容不会刷新 <keep-alive>是Vue的内置组件,能在组件切换过程中将状态保留在内存中,防止重复渲染DOM <keep-aliv ...
- vue 项目 跳转 页面 不刷新 问题
vue项目中需要导出下载客户数据,因为数据太多,响应太慢.后台直接上传给七牛 然后返回一个下载链接 前端通过跳转链接 来下载 riskManagementApi.friendExprotAll(t ...
- 关于Vue中,$this.router.push到当前页面,只是传入参数不同,页面不刷新的问题解决
在页面的watch中,监听$router的变化 watch: { $route (to, from) { this.$router.go(0) } } 其中this.$router.go(0)为刷新页 ...
- Vue Router 常见问题(push报错、push重复路由刷新)
Vue Router 常见问题 用于记录工作遇到的Vue Router bug及常用方案 router.push报错,Avoided redundant navigation to current l ...
随机推荐
- jar命令:打包、查看、更新等
如何把写好的Java程序打包为jar文件呢?下面说的就是java使用命令行打包JAR的方法 1.命令行的方式:打包jar cf JAR文件名称 程序文件名称或者程序所在的文件夹举例:jar cf My ...
- 接口测试工具postman(三)添加断言
每个用例执行完成后,可以通过添加断言来判断返回结果是否正确,即表示用例执行是否成功. 官方说明文档:https://learning.getpostman.com/docs/postman/scrip ...
- Structure From Motion(SFM,从运动恢复结构)
Structure From Motion(SFM,从运动恢复结构) 阅读相关文献: Wu et al. Multicore Bundle Adjustment Agarwal et. al. Bun ...
- Android 之Buletooth
一:概要: Android提供了Buletooth的API ,通过API 我们可以进行如下的一些操作: 1.扫描其他的蓝牙设备 2.查询能配对的蓝牙设备 3.建立RFCOMM 通道 4.连接其他的蓝牙 ...
- picker组件,mode=date,苹果机年份从1开始
由于在IOS上复制图片不方便, 所以用了张别的网站的图 这是在没有设置value和start的情况下出现的,安卓机上显示是好的.尝试完网上相关说法, 发现都不中! 通过各种挣扎啊!~ 心里苦啊~ 复制 ...
- HDU 3696 Farm Game(拓扑+DP)(2010 Asia Fuzhou Regional Contest)
Description “Farm Game” is one of the most popular games in online community. In the community each ...
- 【转】cocos2dx 3.x 集成protobuf
http://www.cnblogs.com/chevin/p/6001872.html vs2013+cocos2dx 3.13.1 这篇博文是集成Lua版本的protobuf,集成C++版本的过程 ...
- 关于MySQL的异常处理 Can't connect to MySQL server on localhost (10061)解决方法
首先检查MySQL 服务没有启动>如果没有启动,则要启动这个服务. 昨天,重起服务器后出现MySQL 'localhost' (10061)错误,开始以为是因为数据库链接打开过多,数据库资源耗尽 ...
- Chromium之各国语言切换
在\src\build\Debug\locales\目录下存放着各国语言所需要的资源文件xx.pak,我这边共有53中语言支持. 命令行进入src\build\Debug目录,敲:chrome.exe ...
- online community
online community spectrum https://spectrum.chat/xgqfrms https://community.xgqfrms.xyz/ https://spect ...