】;2、使用【@tap】事件跳轉。"/> 】;2、使用【@tap】事件跳轉。">

首頁  >  文章  >  web前端  >  uniapp如何實現頁面位址跳轉

uniapp如何實現頁面位址跳轉

coldplay.xixi
coldplay.xixi原創
2020-12-08 16:07:3911164瀏覽

uniapp實現頁面位址跳轉的方法:1、使用navigator標籤,程式碼為【d5231c3ec813bfcaeaa0bf47768ea406】;2、使用【@tap】事件跳轉。

uniapp如何實現頁面位址跳轉

本教學操作環境:windows7系統、uni-app2.5.1版本、thinkpad t480電腦。

推薦(免費):uni-app開發教學

uniapp實作頁面位址跳轉的方法:

1.navigator 標籤

<navigator url="../hello/hello" open-type="navigate">
    <view class="struct">
        I am {{student.age}} yeas old </br>
        I have skills such as {{student.skill[0]}},{{student.skill[1]}}
    </view>
</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: &#39;../info/info?newsid=&#39;+newsid,
                    success: res => {},
                    fail: () => {},
                    complete: () => {}
                });
            }
        }
</script>

#相關免費學習推薦:程式設計影片

以上是uniapp如何實現頁面位址跳轉的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn