微信小程序?qū)崙?zhàn)之登錄頁(yè)面制作(5)
提供一個(gè)登錄頁(yè)的案例,供同學(xué)們使用
項(xiàng)目效果圖:
目錄結(jié)構(gòu):
圖片資源:
name.png
key.png
loginLog.jpg
login.wxml:
<view class="container"> <view class="login-icon"> <image class="login-img" src="../images/loginLog.jpg"></image> </view> <view class="login-from"> <!--賬號(hào)--> <view class="inputView"> <image class="nameImage" src="../images/name.png"></image> <label class="loginLab">賬號(hào)</label> <input class="inputText" placeholder="請(qǐng)輸入賬號(hào)" bindinput="phoneInput" /> </view> <view class="line"></view> <!--密碼--> <view class="inputView"> <image class="keyImage" src="../images/key.png"></image> <label class="loginLab">密碼</label> <input class="inputText" password="true" placeholder="請(qǐng)輸入密碼" bindinput="passwordInput" /> </view> <!--按鈕--> <view class="loginBtnView"> <button class="loginBtn" type="primary" size="{{primarySize}}" loading="{{loading}}" plain="{{plain}}" disabled="{{disabled}}" bindtap="login">登錄</button> </view> </view> </view>
login.wxss:
page{ height: 100%; } .container { height: 100%; display: flex; flex-direction: column; padding: 0; box-sizing: border-box; background-color: #f2f2f2 } /*登錄圖片*/ .login-icon{ flex: none; } .login-img{ width: 750rpx; } /*表單內(nèi)容*/ .login-from { margin-top: 20px; flex: auto; height:100%; } .inputView { background-color: #fff; line-height: 44px; } /*輸入框*/ .nameImage, .keyImage { margin-left: 22px; width: 14px; height: 14px } .loginLab { margin: 15px 15px 15px 10px; color: #545454; font-size: 14px } .inputText { flex: block; float: right; text-align: right; margin-right: 22px; margin-top: 11px; color: #cccccc; font-size: 14px } .line { width: 100%; height: 1px; background-color: #cccccc; margin-top: 1px; } /*按鈕*/ .loginBtnView { width: 100%; height: auto; background-color: #f2f2f2; margin-top: 0px; margin-bottom: 0px; padding-bottom: 0px; } .loginBtn { width: 80%; margin-top: 35px; }
login.js:
Page({ data: { phone: '', password:'' }, // 獲取輸入賬號(hào) phoneInput :function (e) { this.setData({ phone:e.detail.value }) }, // 獲取輸入密碼 passwordInput :function (e) { this.setData({ password:e.detail.value }) }, // 登錄 login: function () { if(this.data.phone.length == 0 || this.data.password.length == 0){ wx.showToast({ title: '用戶名和密碼不能為空', icon: 'loading', duration: 2000 }) }else { // 這里修改成跳轉(zhuǎn)的頁(yè)面 wx.showToast({ title: '登錄成功', icon: 'success', duration: 2000 }) } } })
運(yùn)行結(jié)果:
為大家推薦現(xiàn)在關(guān)注度比較高的微信小程序教程一篇:《微信小程序開(kāi)發(fā)教程》小編為大家精心整理的,希望喜歡。
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
使用Promise鏈?zhǔn)秸{(diào)用解決多個(gè)異步回調(diào)的問(wèn)題
這篇文章主要給大家介紹了使用Promise鏈?zhǔn)秸{(diào)用解決多個(gè)異步回調(diào)問(wèn)題的方法,文中給出了詳細(xì)的介紹和示例代碼,有需要的朋友可以參考借鑒,下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2017-01-01如何利用 JS 腳本實(shí)現(xiàn)網(wǎng)頁(yè)全自動(dòng)秒殺搶購(gòu)功能
這篇文章主要介紹了如何利用 JS 腳本實(shí)現(xiàn)網(wǎng)頁(yè)全自動(dòng)秒殺搶購(gòu)功能,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-10-10javascript斷點(diǎn)調(diào)試心得分享
javascript中程序是怎么可以中斷執(zhí)行,然后一步一步走下去。而且debug的時(shí)候,可以看到變量,調(diào)用棧等東西。這個(gè)是如何實(shí)現(xiàn)的?2016-04-04javascript檢測(cè)flash插件是否被禁用的方法
這篇文章主要介紹了javascript檢測(cè)flash插件是否被禁用的方法,涉及JavaScript調(diào)用ActiveXObject組件操作flash插件的相關(guān)技巧,需要的朋友可以參考下2016-01-01關(guān)于js復(fù)制內(nèi)容到瀏覽器剪貼板報(bào)錯(cuò):Cannot read properties of&n
這篇文章主要給大家介紹了關(guān)于js復(fù)制內(nèi)容到瀏覽器剪貼板報(bào)錯(cuò):Cannot read properties of undefined (reading ‘writeText‘)的解決方案,文中給出了詳細(xì)的原因分析和解決方案,需要的朋友可以參考下2024-01-01js+html+css實(shí)現(xiàn)手動(dòng)輪播和自動(dòng)輪播
這篇文章主要為大家詳細(xì)介紹了js+html+css實(shí)現(xiàn)手動(dòng)輪播和自動(dòng)輪播效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-12-12