微信小程序 (十七)input 組件詳細(xì)介紹
input輸入框使用的頻率也是比較高的。。。樣式的話自己外面包裹個view自己定義。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)聽手機(jī)號輸入 */ 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('手機(jī)號為: ', this.data.phone); console.log('密碼為: ', this.data.password); }, onLoad:function(options){ // 頁面初始化 options為頁面跳轉(zhuǎn)所帶來的參數(shù) }, onReady:function(){ // 頁面渲染完成 }, onShow:function(){ // 頁面顯示 }, onHide:function(){ // 頁面隱藏 }, onUnload:function(){ // 頁面關(guān)閉 } })
wxss
.input{ padding-left: 10px; height: 44px; } .inputView{ border: 2px solid red; border-radius: 40px; margin-left: 15px; margin-right: 15px; margin-top: 15px; }
相關(guān)文章:
hello WeApp icon組件
Window text組件 switch組件
tabBar底部導(dǎo)航 progress組件 action-sheet
應(yīng)用生命周期 button組件 modal組件
頁面生命周期 checkbox組件 toast組件
模塊化詳 form組件詳 loading 組件
數(shù)據(jù)綁定 input 組件 navigator 組件
View組件 picker組件 audio 組件
scroll-view組件 radio組件 video組件
swiper組件 slider組件 Image組件
相關(guān)文章
ASP.NET Core2讀寫InfluxDB時序數(shù)據(jù)庫的方法教程
Influxdb是一個開源的分布式時序、時間和指標(biāo)數(shù)據(jù)庫,使用go語言編寫,無需外部依賴,下面這篇文章主要給大家介紹了關(guān)于ASP.NET Core2讀寫InfluxDB時序數(shù)據(jù)庫的相關(guān)資料,需要的朋友可以參考下2018-11-11ASP.NET中使用GridView實現(xiàn)分級顯示的代碼
在實際項目開發(fā)中,往往需要用到在頁面上對列表的項目實現(xiàn)分級顯示,在 ASP.NET中沒有現(xiàn)成的控件。2010-06-06ASP.NET Core MVC基礎(chǔ)學(xué)習(xí)之局部視圖(Partial Views)
這篇文章主要給大家介紹了關(guān)于ASP.NET Core MVC基礎(chǔ)學(xué)習(xí)之局部視圖(Partial Views)的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用ASP.NET Core MVC具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08asp.net配置會話狀態(tài)Session實現(xiàn)代碼
在Web應(yīng)用程序中,都會有一個Web.config文件來配置當(dāng)前Web項目。其中包括關(guān)于會話狀態(tài)Session的配置2012-10-10.NET IoC模式依賴反轉(zhuǎn)(DIP)、控制反轉(zhuǎn)(Ioc)、依賴注入(DI)
這篇文章主要介紹了.NET IoC模式依賴反轉(zhuǎn)(DIP)、控制反轉(zhuǎn)(Ioc)、依賴注入(DI),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-06-06深入Lumisoft.NET組件與.NET API實現(xiàn)郵件發(fā)送功能的對比分析
本篇文章對Lumisoft.NET組件與.NET API實現(xiàn)郵件發(fā)送的功能兩者進(jìn)行了深入的對比分析。需要的朋友參考下2013-05-05