欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序-獲得用戶輸入內(nèi)容

 更新時(shí)間:2017年02月13日 15:05:12   作者:huangenai  
本文主要介紹了微信小程序中獲得用戶輸入內(nèi)容的方法。具有很好的參考價(jià)值,下面跟著小編一起來看下吧

在微信小程序里,如何獲得用戶輸入的內(nèi)容??

js: document.getElementById("Content").value

jq:$("#Content").val()

在微信小程序中并不能這樣寫。

可以通過組件的屬性 bindchange 將用戶輸入的儲(chǔ)存存起來

test.wxml

<input id="postalCode" bindchange="bindChange" type="number" placeholder="輸入郵政編碼" auto-focus />
<input id="mail" bindchange="bindChange" type="number" placeholder="請(qǐng)輸入郵箱地址" />

test.js

var inputContent = {}
Page({
 data: {
 inputContent: {}
 },
 bindChange: function(e) {
 inputContent[e.currentTarget.id] = e.detail.value
 }
})

后臺(tái)輸出

以上就是本文的全部?jī)?nèi)容,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時(shí)也希望多多支持腳本之家!

相關(guān)文章

最新評(píng)論