【RuoYi移动端】uni-app中通过switchTab路由跳转不加载onload事件或不刷新页面的解决方法

主要是底部导航菜单,用switchTab只是切换,不刷新

1、跳转前的页面

					
					uni.$emit('refreshIndex') // 执行这个事件代码
					this.$tab.switchTab('/pages/index');

2、跳转到的页面

onLoad: async function(query) {

			// 监听自定义事件
			uni.$on('refreshIndex', () => {
				// 在这里执行onLoad逻辑
				this.loadData()
			})
}

猜你喜欢

转载自blog.csdn.net/dxnn520/article/details/133203116