总结归纳uni-app页面跳转的多种方式
根据官方设计,uni-app的页面跳转有多种方式。其中很常用的两种方式:
1,navigator标签方式
- <navigator url="../hello/hello" open-type="navigate">
- <view class="zjcopy'">
- 直接复制网
- </view>
- </navigator>
2,函数跳转方式
- <view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(item,index) in news" :key="index" @tap="openinfo">
- <view class="uni-media-list-text-top">{{item.title}}</view>
- </view>
-
-
- <script>
- methods: {
- openinfo(e) {
- console.log(e)
- var newsid = e.currentTarget.data.newsid ;
- uni.navigateTo({
- url: '../info/info?newsid='+newsid,
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- }
- }
- </script>
除此之外,官方对特定页面还有几种处理:
- navigate 对应 uni.navigateTo 的功能
-
- redirect 对应 uni.redirectTo 的功能
-
- switchTab 对应 uni.switchTab 的功能
-
- reLaunch 对应 uni.reLaunch 的功能 微信小程序
-
- navigateBack 对应 uni.navigateBack 的功能 微信小程序