Page({ /** * 页面的初始数据 */ data: { nozzleId: '', quantify: '元', fastInputs: [10, 20, 50, 100, 200, 500], type: [ { name: '金额', checked: true }, { name: '升数', checked: false } ], inputValue: '0.00', inputTip: '请输入金额', amount:'' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { const id = decodeURIComponent(options.q) // 获取到二维码原始链接内容 this.setData({ nozzleId: id }) wx.showToast({ title: id, }) }, /** * 处理快速输入金额的点击事件 */ onFastInputClick(event) { console.log("点击",event) const amount =event.currentTarget.dataset.id; this.setData({ inputValue: amount }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { }, /** * 当选择定量类型 */ onTypeChange(event) { var type = event.detail.value; if (type == '升数') { this.setData({ quantify: '升', inputTip: '请输入升数' }); } else { this.setData({ quantify: '元', inputTip: '请输入金额' }); } } })