Vue:uni-app学习(二)--页面跳转

 页面跳转:

<template>
    <view class="content">

      <navigator url="../form/form" open-type="navigate">
        <button type="primary" class="button1">表单设置1-支持返回</button>
      </navigator>

        <button type="primary" class="button1" @click="jumpToPage('/pages/sub/form/form','')">表单设置2-支持返回</button>
        <button type="primary" class="button1" @click="jumpToPage('/pages/my/my','tab')">跳转至my-tab</button>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                title: 'Hello'
            }
        },
        onLoad() {

        },
        methods: {
            jumpToPage(url,type){
                if(type == 'tab'){
                    uni.switchTab({
                        url: url
                    })
                }else{
                    uni.navigateTo({
                        url: url
                    })
                }
                
            }
        }
    }
</script>

<style>
    .button1{
        margin-top: 20px;
    }
</style>

 

posted @ 2020-08-11 21:44  wukong1688  阅读(684)  评论(0编辑  收藏  举报