頁面被擠壓了 怎么才能不被擠壓上去
<template>
<div class="login">
<div class="logo">
<div class="pic"></div>
</div>
<div class="inp">
<div class="number">
<i class="icon"></i>
<input type="text" ref="mobile" v-model="loginData.mobile" placeholder="請輸入手機(jī)號" >
</div>
<div class="code">
<i class="icon"></i>
<input type="text" v-model="loginData.authCode" placeholder="請輸入驗(yàn)證碼">
<div class="codetime">
<button @click="getCode" class="code-btn" :disabled="!show">
<span v-show="show">獲取驗(yàn)證碼</span>
<span v-show="!show" class="count">{{count}}秒后可以從新獲取</span>
</button>
</div>
</div>
</div>
<div class="agree">
<label for="select" class="radio" @touchstart="touch">
<img ref="img1" src="../assets/svg/icon_ccc.svg" width="18" style="vertical-align: -3px;display: none" >
<img ref="img2" src="../assets/svg/icon_agree.svg" width="18" style="vertical-align: -3px;">
我已經(jīng)閱讀并同意<span>棱鏡APP用戶協(xié)議</span>
</label>
</div>
<div class="button">
<mt-button type="primary" @click="login" :disabled="!loginData.mobile || !loginData.authCode">進(jìn)入棱鏡</mt-button>
</div>
<!-- <button @click="register">進(jìn)入注冊頁</button> -->
</div>
</template>
<script>
import { Toast } from "mint-ui";
export default {
data() {
return {
loginData: {
mobile: "",
authCode: ""
},
TIME_COUNT: 5,
show: true,
count: "",
timer: null,
flag: true
};
},
created() {},
methods: {
// 選擇是否同意協(xié)議--
touch() {
console.log(this.flag);
if (this.flag) {
this.flag = false;
this.$refs.img1.style.display = "inline-block";
this.$refs.img2.style.display = "none";
} else {
this.$refs.img1.style.display = "none";
this.$refs.img2.style.display = "inline-block";
this.flag = true;
}
},
// 選擇是否同意協(xié)議--
login() {
console.log(this.loginData);
let url =
"http://dsn.apizza.cc/mock/33a3028a1c490faf003f2b6196f2cc92/data1"; /** 登錄(發(fā)送 手機(jī)號 和 驗(yàn)證碼) */
this.$http.post(url, this.loginData).then(
function(res) {
if (res.body.code === 1) {
this.$router.push({ name: "register" });
} else if (res.body.code === 0) {
this.$router.push({ name: "list" });
} else {
Toast("密碼錯(cuò)誤");
}
},
function(res) {
Toast("登錄錯(cuò)誤");
}
);
},
register() {
this.$router.push({ path: "/register" });
},
// 獲取驗(yàn)證碼---
getCode() {
this.mobile = this.$refs.mobile.value;
let url =
"http://dsn.apizza.cc/mock/4c0fdc85afc6c0f01766671f4f13ace3/plus/sms_vcode"; /** 獲取驗(yàn)證碼 */
this.$http.post(url, { mobile: this.mobile }).then(
function(res) {
Toast({ message: "成功獲取驗(yàn)證碼", position: "bottom" });
},
function(res) {
Toast("發(fā)送錯(cuò)誤");
}
);
Toast("驗(yàn)證碼已經(jīng)發(fā)送到" + this.mobile + "這個(gè)手機(jī)號上");
if (!this.timer) {
this.count = this.TIME_COUNT;
this.show = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= this.TIME_COUNT) {
this.count--;
} else {
this.show = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
}
// 獲取驗(yàn)證碼---
}
};
</script>
<style lang="less" scoped>
.login {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url("../../static/imgs/bgi.png") no-repeat;
background-size: cover;
.logo {
.pic {
width: 16vw;
height: 14vh;
line-height: 70px;
text-align: center;
margin: 14vh auto;
background: url("../../static/imgs/logo@3x.png") no-repeat;
background-size: 100% 100%;
}
.word {
font-size: 25px;
font-weight: bold;
text-align: center;
}
}
.inp {
.number {
// border:1px solid red;
font-size: 0;
margin: 10px auto;
width: 68vw;
height: 7vh;
border-bottom: 1px solid #ccc;
box-sizing: border-box;
padding: 10px;
.icon {
display: inline-block;
width: 20px;
height: 20px;
background: url("../../static/imgs/user@3x.png") no-repeat;
background-size: 100% 100%;
vertical-align: sub;
}
> input {
background: none;
outline: none;
border: 0px;
width: 150px;
font-size: 14px;
padding: 0 10px;
color: #fff;
}
}
.code {
// border:1px solid red;
font-size: 0;
text-align: center;
margin: 10px auto;
margin-top: 40px;
width: 68vw;
height: 7vh;
border-bottom: 1px solid #ccc;
box-sizing: border-box;
.icon {
display: inline-block;
width: 20px;
height: 20px;
background: url("../assets/imgs/mima@3x.png") no-repeat;
background-size: 100% 100%;
vertical-align: sub;
}
input {
height: 25px;
width: 25vw;
background: none;
outline: none;
border: 0px;
font-size: 14px;
padding: 0 10px;
color: #fff;
}
.codetime {
display: inline-block;
button {
outline: none;
border: 0px;
width: 28vw;
height: 4vh;
padding: 0;
border-radius: 14vw;
}
}
}
}
.agree {
margin: 30px auto;
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
color: #fff;
font-size: 13px;
span {
color: #48a1e3;
text-decoration: underline;
}
}
.button {
text-align: center;
> button {
outline: none;
border: 0px;
padding: 0;
width: 68vw;
height: 7vh;
border-radius: 34vw;
font-size: 5vw;
font-weight: bold;
color: #fff;
background-color: #48a1e3;
}
}
}
</style>
使用vh作為高度的單位,這是后遺癥,軟鍵盤彈出后,整個(gè)頁面高度發(fā)生變化。比如說,原來的視窗高度為1334px,那么14vh的高度就是1334 x 0.14 = 186.76(px) ; 小鍵盤彈出來后高度變?yōu)?800px, 那么14vh的高度只有 800 x 0.14 = 112(px)了;但是vw卻沒有改變,所以你看到的視圖是變形的。
解決方案: 統(tǒng)一使用vw布局;
建議參考分享手淘過年項(xiàng)目中采用到的前端技術(shù)對vw進(jìn)行兼容處理
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
北大青鳥中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。