• uni-app学习记录03-路由跳转(示例代码)


    <template>
        <view class="content">
            <!-- v-show是相对于display: none -->
            <view v-show="false"></view>
            <!-- v-if是删除这个元素 -->
            <view v-if="false"></view>
            <view>我是文本</view>
            <button type="primary" @click="toPath">跳转注册页面</button>
            <button type="primary" @click="toPath1">跳转未注册页面</button>
            <button type="primary" @click="toPath2">关闭当前页面再跳转</button>
            <button type="primary" @click="toPath3">可以返回几层页面 默认为一层</button>
        </view>
    </template>
    
    <script>
        import test from "../../components/test.vue"
        export default {
            data() {
                return {
                    msg: "小白",
                }
            },
            methods: {
                toPath() {
                    // 这个用于跳转到Tab注册过的页面
                    uni.switchTab({
                        url: "../shezhi/shezhi"
                    })
                },
                toPath1() {
                    // 这个可以跳转到未在tab注册的页面,跳转是时注意这个会保留当前页面重新打开新的页面 一般用于要返回的页面
                    uni.navigateTo({
                        // 在跳转的地址后面传参
                        url: "../one/one?name=huoyan"
                    });
                },
                toPath2(){
                    // 关闭当前页面之后再进行跳转
                    uni.redirectTo({
                        url: "../one/one"
                    })
                },
                toPath3(){
                    // 返回上层页面 不填参数默认为1
                    uni.navigateBack({
                        delta: 1
                    });
                }
            },
        }
    </script>
  • 相关阅读:
    java学习笔记 (2) —— Struts2类型转换、数据验证重要知识点
    java学习笔记 (1) —— Strut2.3.24环境搭建
    数据不平衡问题的处理
    正则化与特征稀疏,过拟合
    leetcode144-先序遍历非递归实现
    解释器资料
    ROC,AUC
    假设检验——KS检验
    SVM理解
    高斯过程与核密度估计
  • 原文地址:https://www.cnblogs.com/onesea/p/14875258.html
Copyright © 2020-2023  润新知