uni-app 页面跳转的两种方法

1.navigator 标签

1 <navigator url="../hello/hello" open-type="navigate">
2     <view class="struct">
3         I am {{student.age}} yeas old br>
4         I have skills such as {{student.skill[0]}},{{student.skill[1]}}
5     view>
6 </navigator>

 

 

2.@tap事件跳转

 

<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.dataset.newsid ;    
                uni.navigateTo({
                    url: '../info/info?newsid='+newsid,
                    success: res => {},
                    fail: () => {},
                    complete: () => {}
                });
            }
        }
script>

 

转载于:https://www.cnblogs.com/lccode/p/10615382.html

你可能感兴趣的:(uni-app 页面跳转的两种方法)