微信小程序---獲取輸入框(input)內容
wxml
<input placeholder="請輸入手機號碼" maxlength="11" type="tel" bindinput="getInput" />
js
Page({
data:{
getInput: null
},
getInput:function(e){//方法1
this.data.getInput = e.detail.value;
},
//getInput: function (e) {//方法2
//this.setData({
//getInput: e.detail.value
//})
//} //這樣寫在別處調用時this.data.getInput即可
})
微信小程序---獲取input輸入框里面的value值
wxml
<input placeholder="請輸入手機號碼" maxlength="11" type="tel" bindinput="getInput" value="{{telValue}}" />
js
Page({
data:{
telValue: '',
getInput: ''
},
getInput:function(e){
this.setData({
telValue: e.detail.value
})
}
})
- 個人覺得都一樣,只是多了個value,可能是菜鳥的緣故還沒發現多大不同
微信小程序input標簽中文字被遮蓋的問題
- 在設置input組件的寬度的時候,如果是width的值,則不能用百分比,而要用真是的數據,比如px、rpx等
還有一種情況就是真需要用到百分比,那么可設置的input組件的min-width和max-width,但注意:如果設置min-width或max-width屬性,不可設置width屬性 - 設置min-width或max-width可解決