提交 f359130e 编写于 作者: W wanganxp

完善界面提示

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