uni-app 输入框软键盘把背景图顶上来

1、demo.vue

<template>
    <view class="container" :style="'height:'+screenHeight+'px !important;'">
        <view class="welcome">
            <view>您好,</view>
            <view>欢迎登录。</view>
        </view>
        <form @submit="formSubmit" @reset="formReset">
            <view class="form_view">
                <view class="input-view">
                    <view class="label-view">
                        <view class="icon iconfont iconicon_patriarch"></view>
                    </view>
                    <input class="input" type="text" placeholder="请输入账号" placeholder-style="color:#999999;font-size:30upx" v-model="nameValue" />
                </view>
                <view class="input-view">
                    <view class="label-view">
                        <view class="icon iconfont iconicon_little_taget"></view>
                    </view>
                    <input class="input" type="text" placeholder="请输入密码" placeholder-style="color:#999999;font-size:30upx" v-model="passwordValue" />
                </view>
            </view>            
        </form>
        <view class="button-view">
            <button :loading="loading" class="login" formType="submit">登录</button>
        </view>
    </view>
</template>

<script>
    
    export default {
        components: {
            
        },
        data() {
            return {
                nameValue: '',
                passwordValue: '',
                screenHeight: '',
                loading: false
            }
        },
        methods: { 
        },
        onReady() {
            
        },
        onLoad() {
            this.screenHeight = uni.getSystemInfoSync().windowHeight;
        }

    }
</script>

<style>
    @import '../static/css/demo.css';
</style>

将demo.css放入static里的css文件中

在demo.css中的背景图换成你项目中需要的背景图即可


2、demo.css

page{
    width: 100%;
    height: 100%;
}

.container{
    width: 100%;
    height: 100%;

    min-height: 100%;
    background: url(demo.png) no-repeat;
    background-size: 100% 100%;
    position: relative;
}
.welcome{
    width: 214upx;
    height: 106upx;
    margin: 0 auto;
    margin-left: 50upx;
    padding-top: 150upx;
}
.input-view{
    width: 650upx;
    height: 57upx;
    display: flex;
    align-items: center;
    border-bottom: 1upx solid #dddddd;
    margin: 60upx auto;
}
.input-view input{
    margin-left: 20upx;
}
.input-view .icon{
    color: #bbbbbb;
}
.placeholderStyle{
    font-size: 30upx;
    color: #999999;
}
.form_view{
    width: 650upx;
    height: 176upx;
    margin: 105upx auto;
}
button{
    width: 560upx;
    height: 90upx;
    font-size: 48upx;
    color: #fffefe;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3196fb;
    box-shadow: 0 0 10upx rgba(49,150,251,0.3);
}
.dns{
    color: #FFFFFF;
    font-size: 24upx;
    width: 710upx;
    text-align: right;
    position: absolute;
    bottom: 30upx;
}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值