uni-app动态设置不同手机类型高度背景图占全屏

1、demo.vue

<template>
    <view class="container" :style="'height:'+ screenHeight +'px !important;'">
        <view class="login_box">
            
        </view>
    </view>
</template>

2、js部分

<script>
    export default {
        data() {
            return {
                screenHeight: '',
            }
        },
        methods: {
            
        },
        onLoad() {
            this.screenHeight = uni.getSystemInfoSync().windowHeight;
        }
    }
</script>

3、css部分

<style>
    page{
        width: 100%;
        height: 100%;
    }
    .container{
        width: 100%;
        min-height: 100%;
    }
</style>


版权声明:本文为zhongli_原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。