<text bindtap='tapScan'>Scan</text>
<form bindsubmit='firstSubmit' id="main">
<input type='text' name='dest' value='{{addr}}' focus='true' disabled='{{disable}}' />
<button formType='submit' hover-class='hoverBtn'>Button</button>
</form>
Page({
data: {
addr: '',
disable: false
},
tapScan() {
var me = this
wx.scanCode({
scanType: ['qrCode'],
success: function(res) {
console.log(res)
me.setData({
addr: res.result
})
}
})
}
})
扫任意二维码后给input 赋值:
1. input disabled 属性为变量或不标示disabled 属性时,input value 均无法显示,是个空白,但 form submit 可取得value
2. 当 input 写死 disabled=‘{{true}}’ 时,value 可以显示
机型: iphone 6 plus, ios12
代码段:
wechatide://minicode/eO23BKmy7b2c