input组件的2个用法
js获得input的输入字符后,js怎样清除input.value?
想把input放在一个window的bottom,做一个类似聊天的窗口,wxml怎么layout?
1 回复
wxml代码
< view >{{submit_value}}</ view > < view style = "position:fixed;bottom:0;left:0;width:100%;background:#09bb07;display:flex;flex-direction:row" > < input type = "text" value = "{{input_value}}" bindinput = "input" style = "padding:3px;background:#ffffff;margin:5px;flex:1" /> < button type = "default" size = "mini" style = "margin:5px" bindtap = "submit" >提交</ button > </ view > |
js代码
Page({ data: { input_value: '' , submit_value: '' }, input: function (e){ this .setData({submit_value:e.detail.value}) }, submit: function (e){ this .setData({input_value: '' }) }, }) |