提交 f359130e 编写于 作者: W wanganxp

完善界面提示

上级 85590a4d
<template> <template>
<view> <view>
<button @click="addInterceptor">添加拦截器</button> <button @click="addInterceptor">添加路由拦截器</button>
<button @click="removeInterceptor">移除拦截器</button> <button @click="removeInterceptor">移除路由拦截器</button>
<text>点击下方按钮{{msg}}</text>
<button @click="navigateTo">跳转到测试页面</button> <button @click="navigateTo">跳转到测试页面</button>
</view> </view>
</template> </template>
...@@ -26,21 +27,23 @@ ...@@ -26,21 +27,23 @@
export default { export default {
data() { data() {
return { return {
msg:"会跳转到测试页面1"
} }
}, },
methods: { methods: {
addInterceptor() { addInterceptor() {
uni.addInterceptor('navigateTo', interceptor) uni.addInterceptor('navigateTo', interceptor)
uni.showToast({ uni.showToast({
title: '拦截器已添加' title: '页面跳转已拦截'
}) })
this.msg = ",路由被劫持到测试页面2"
}, },
removeInterceptor() { removeInterceptor() {
uni.removeInterceptor('navigateTo', interceptor) uni.removeInterceptor('navigateTo', interceptor)
uni.showToast({ uni.showToast({
title: '拦截器已移除' title: '拦截器已移除'
}) })
this.msg = "会跳转到测试页面1"
}, },
navigateTo() { navigateTo() {
uni.navigateTo({ uni.navigateTo({
...@@ -59,4 +62,4 @@ ...@@ -59,4 +62,4 @@
<style> <style>
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册