微信開發(fā)中input輸入框的示例分析

這篇文章給大家分享的是有關微信開發(fā)中input輸入框的示例分析的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

創(chuàng)新互聯(lián)公司主營滄州網(wǎng)站建設的網(wǎng)絡公司,主營網(wǎng)站建設方案,app軟件開發(fā),滄州h5微信小程序搭建,滄州網(wǎng)站營銷推廣歡迎滄州等地區(qū)企業(yè)咨詢

微信開發(fā)中input輸入框的示例分析

input輸入框使用的頻率也是比較高的。。。樣式的話自己外面包裹個view自己定義。input屬性也不是很多,有需要自己慢慢測,嘗試

主要屬性:

微信開發(fā)中input輸入框的示例分析

wxml

<!--style的優(yōu)先級比class高會覆蓋和class相同屬性-->
<view class="inputView" style="margin-top: 40% ">
<input class="input" type="number" placeholder="請輸入賬號" placeholder-style="color: red" bindinput="listenerPhoneInput" />
</view>
  
<view class="inputView">
<input class="input" password="true" placeholder="請輸入密碼" placeholder-style="color: red" bindinput="listenerPasswordInput"/>
</view>
  
  
<button style="margin-left: 15rpx; margin-right: 15rpx; margin-top: 50rpx; border-radius: 40rpx" type="primary" bindtap="listenerLogin">登錄</button>

js

Page({
 /**
 * 初始化數(shù)據(jù)
 */
 data:{
 phone: '',
 password: '',
 },
  
 /**
 * 監(jiān)聽手機號輸入
 */
 listenerPhoneInput: function(e) {
  this.data.phone = e.detail.value;
  
 },
  
 /**
 * 監(jiān)聽密碼輸入
 */
 listenerPasswordInput: function(e) {
  this.data.password = e.detail.value;
 },
  
 /**
 * 監(jiān)聽登錄按鈕
 */
 listenerLogin: function() {
  //打印收入賬號和密碼
 console.log('手機號為: ', this.data.phone);
 console.log('密碼為: ', this.data.password);
 },
  
 onLoad:function(options){
 // 頁面初始化 options為頁面跳轉所帶來的參數(shù)
 },
 onReady:function(){
 // 頁面渲染完成
 },
 onShow:function(){
 // 頁面顯示
 },
 onHide:function(){
 // 頁面隱藏
 },
 onUnload:function(){
 // 頁面關閉
 }
})

wxss

.input{
 padding-left: 10px;
 height: 44px;
}
  
.inputView{
 border: 2px solid red;
 border-radius: 40px;
 margin-left: 15px;
 margin-right: 15px;
 margin-top: 15px;
}

感謝各位的閱讀!關于“微信開發(fā)中input輸入框的示例分析”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

本文名稱:微信開發(fā)中input輸入框的示例分析
網(wǎng)址分享:http://bm7419.com/article42/pschec.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作靜態(tài)網(wǎng)站、自適應網(wǎng)站、外貿(mào)網(wǎng)站建設、品牌網(wǎng)站建設、網(wǎng)站營銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設公司