zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    使用SELECT语句检索数据
    redis的安装和使用【2】redis的java操作
    Python之数据结构改造
    InnoDB undo log物理结构的初始化
    Redis-RDB持久化设置
    MySql(四)Select条件查询
    Node.js TLS/SSL
    Node.js 定时器
    Node.js 系统
    Node.js 字符串解码器
  • 原文地址:https://www.cnblogs.com/onesea/p/14875258.html
Copyright © 2011-2022 走看看