微信小程序获取input框的值

发布时间:2025-02-17 11:31

使用微信小程序的'每日红包',在日常购物中随机获取优惠 #生活技巧# #节省生活成本# #购物优惠技巧# #比价应用#

最新推荐文章于 2023-11-03 13:07:11 发布

qq_40536470 于 2018-07-18 17:19:59 发布

html

<view class="itemView">用户名:
<input class="input" name="userName" placeholder="请输入用户名"
bindinput ="userNameInput"/>
</view>
<view class="itemView">密 码:
<input class="input" password placeholder="请输入密码"
bindinput="passWdInput" />
</view>
<view class="viewName" style="background-color:#fbf9fe">
<button class="loginBtn" bindtap="loginBtnClick">登录</button>
</view>

js

// pages/index/login.js
Page({
data: {
userName: '',
userPwd:""
},
//获取用户输入的用户名
userNameInput:function(e)
{
this.setData({
userName: e.detail.value
})
},
passWdInput:function(e)
{
this.setData({
userPwd: e.detail.value
})
},
//获取用户输入的密码
loginBtnClick: function (e) {
console.log("用户名:"+this.data.userName+" 密码:" +this.data.userPwd);
}
,
// 用户点击右上角分享
onShareAppMessage: function () {

}
})

网址:微信小程序获取input框的值 https://www.yuejiaxmz.com/news/view/778842

相关内容

微信小程序todolist
微信小程序常用控件汇总
微信小程序的所有scene场景值 2020
微信小程序 iOS type=“nickname”无效
python3从input()方法获取信息的方式
JS中给input框赋值
基于小程序184家政服务系统APP微信小程序项目(源码+文档+运行视频+讲解视频)
基于微信小程序的旧衣回收系统
【微信小程序】基础篇
(unfinish)【微信小程序】获取用户信息的流程+javascript的回调函数代码分析

随便看看