美文网首页uni - app
uni-app 设置引导页

uni-app 设置引导页

作者: 晚安_bd35 | 来源:发表于2019-06-18 10:45 被阅读0次

  • 首先在 pages.json 里配置,引导页放在第一显示页并禁用原生导航栏
{
    "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
        {
            "path" : "pages/intro/intro",
            "style" : {
                "app-plus":{
                    "titleNView":false //禁用原生导航栏
                }
            }
        },{
            "path": "pages/index/index", //首页
            "style": {
                "navigationBarTitleText": "首页"
            }
        }
        
    ],
    "globalStyle": {
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "uni-app",
        "navigationBarBackgroundColor": "#F8F8F8",
        "backgroundColor": "#F8F8F8"
    }
}

  • 设置 intro.vue 页面样式,下面代码是简易的轮播图可以先复制下来看一下效果,再根据自己的需求调整
<template>
    <view class="content">
        <swiper class="swiper" :indicator-dots="true" :style="{'height':windowHeight}"
         @animationfinish="animationfinish">
            <swiper-item>
                <view class="swiper-item" :style="{'height':windowHeight,'background-color':'red'}">A</view>
            </swiper-item>
            <swiper-item>
                <view class="swiper-item" :style="{'height':windowHeight,'background-color':'green'}">B</view>
            </swiper-item>
            <swiper-item>
                <view class="swiper-item" :style="{'height':windowHeight,'background-color':'pink'}">C</view>
            </swiper-item>
            <swiper-item>
                <view class="swiper-item" :style="{'height':windowHeight,'background-color':'yellow'}">进入首页</view>
            </swiper-item>
        </swiper>
        <!-- <text :style="{color:'red','font-weight':200}">这是一个sssH1</text> -->
    </view>
</template>
<script>
    export default {
        data() {
            return {
                windowHeight: '603px'  //定义手机屏幕高度值变量
            }
        },
        onLoad() {
            var _me = this;
            uni.getSystemInfo({//获取手机屏幕高度信息,让swiper的高度和手机屏幕一样高
                success: function(res) {
                    console.log(res.model);
                    console.log(res.pixelRatio);
                    console.log(res.windowWidth);
                    console.log(res.windowHeight);//这里是手机屏幕高度
                    console.log(res.language);
                    console.log(res.version);
                    console.log(res.platform);
                    _me.windowHeight = res.windowHeight + 'px';
                    console.log('手机屏幕高度为' + _me.windowHeight);
                }
            });
        },
        methods: {
            animationfinish(e) {
                console.log(JSON.stringify(e.detail.current));
                //判断到最后一张后,自动转向进入首页
                if (e.detail.current == 3) {
                    console.log('动画已经播放结束');
                    setTimeout(function() {
                        uni.redirectTo({
                            url: '/pages/index/index'
                        });
                    }, 1000)
                }
            }
        }
    }
</script>
<style>
    .swiper {
        width: 100%;
        /*     height: 100vw; */
        /* background: red; */
    }
</style>


这个引导页是每次进入app的时候都会显示的,只需要第一次打开的时候出现,需要判断一下,后期附上代码


参考:https://www.uniapp.club/thread-13.htm

相关文章

  • uni-app 设置引导页

    首先在 pages.json 里配置,引导页放在第一显示页并禁用原生导航栏 设置 intro.vue 页面样式,...

  • uni-app设置引导页源码

    是引导页(guide) 不是 启动界面 (splash)详细设置步骤见:uniapp设置引导页 https://w...

  • 设置引导页

    1.新建一个WelcomeViewController,代码如下 2,在AppDelegate.m文件中添加 注意...

  • APP启动次数判断

    APP的启动次数判断,用来设置引导图欢迎页登录等设置

  • App页面分类

    引导页(欢迎页) 过渡页(启动页) 加载页 沉浸式页面 功能页,eg: 登陆、注册,设置,发布… 列表页 正文页,...

  • Android开发-引导页图片滑动效果

    Android开发-引导页图片滑动效果 需求: 打开app引导页图片产生滑动动画效果,根据需要将图片设置渐变、滑动...

  • swift有一句代码搞定APP引导页(图片/GIF/视频)

    APP启动引导页(图片/gif/视频) 在APP启动时候设置引导页,不管图片,gif,还是视频只需要一个方法 视频...

  • iPad开发之引导页设置

    在iPad开发时,引导页是不允许屏幕旋转的,原因在于当屏幕旋转时,引导页图片会发生偏移,前提是引导页是写活的情况,...

  • iOS_LoadingController

    App 启动的引导页制作,如下步骤 设置 ViewController 的 View 为 ImageView; 添...

  • 关于iOS设置引导页优化问题

    现在,总结一下设置iOS app引导页,所误入的坑 之前呢,所提交的版本没有怎么关注过引导页的优化问题,自认为让设...

网友评论

    本文标题:uni-app 设置引导页

    本文链接:https://www.haomeiwen.com/subject/hnfefctx.html