提交 46d418ce 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

types(interceptor): 修复类型错误

上级 959692de
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<button class="navigatorButton">navigator组件跳转到测试页面</button> <button class="navigatorButton">navigator组件跳转到测试页面</button>
</navigator> </navigator>
<button @click="addSwitchTabInterceptor">添加switchTab拦截器</button> <button @click="addSwitchTabInterceptor">添加switchTab拦截器</button>
<button @click="removeSwitchTabInterceptor">移除switchTab拦截器</button> <button @click="removeSwitchTabInterceptor">移除switchTab拦截器</button>
<button class="navigatorButton" @click="switchTab">switchTab API</button> <button class="navigatorButton" @click="switchTab">switchTab API</button>
</view> </view>
</template> </template>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
complete: function (res : NavigateToComplete) { complete: function (res : NavigateToComplete) {
console.log('拦截 navigateTo 接口 complete 返回参数为:', res) console.log('拦截 navigateTo 接口 complete 返回参数为:', res)
} }
} as Interceptor } as AddInterceptorOptions
const switchTabInterceptor = { const switchTabInterceptor = {
invoke: function (options : SwitchTabOptions) { invoke: function (options : SwitchTabOptions) {
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
complete: function (res : SwitchTabComplete) { complete: function (res : SwitchTabComplete) {
console.log('拦截 switchTab 接口 complete 返回参数为:', res) console.log('拦截 switchTab 接口 complete 返回参数为:', res)
} }
} as Interceptor } as AddInterceptorOptions
export default { export default {
data() { data() {
...@@ -75,12 +75,12 @@ ...@@ -75,12 +75,12 @@
title: '拦截器已移除' title: '拦截器已移除'
}) })
this.msg = "会跳转到测试页面1" this.msg = "会跳转到测试页面1"
}, },
addSwitchTabInterceptor() { addSwitchTabInterceptor() {
uni.addInterceptor('switchTab', switchTabInterceptor) uni.addInterceptor('switchTab', switchTabInterceptor)
}, },
removeSwitchTabInterceptor() { removeSwitchTabInterceptor() {
uni.removeInterceptor('switchTab', switchTabInterceptor) uni.removeInterceptor('switchTab', switchTabInterceptor)
}, },
navigateTo() { navigateTo() {
uni.navigateTo({ uni.navigateTo({
...@@ -112,4 +112,4 @@ ...@@ -112,4 +112,4 @@
} }
} }
} }
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册