// template/selectMore/selectMore.js Component({ /** * 组件的属性列表 */ properties: { img: String, title: String, multiple: Boolean, value1: Number, value2: Number }, /** * 组件的初始数据 */ data: { show: false, rent_min: '', rent_max: "" }, observers: { "value1": function (e) { if (!this.properties.formSelect) { this.setData({ rent_min: e || '' }) } }, "value2": function (e) { if (!this.properties.formSelect) { this.setData({ rent_max: e || '' }) } }, }, /** * 组件的方法列表 */ methods: { catchmove() {}, // 显示与隐藏 showAlert(e) { this.setData({ show: e.currentTarget.dataset.show == 1 ? true : false }) }, // 输入 input(e) { let input = e.currentTarget.dataset.input; let value = e.detail.value; if (input == 'rent_min') { this.setData({ rent_min: value }) } else { this.setData({ rent_max: value }) } }, // 提交 submit() { this.data.rent_min = parseInt(this.data.rent_min) this.data.rent_max = parseInt(this.data.rent_max) if (this.data.rent_max * 1 > 0) { // 如果有输入最大金额 if (this.data.rent_max * 1 < this.data.rent_min * 1) { wx.showModal({ title: '提示', content: '租金区间最大金额不能小于最小金额~', }) return false } } console.log("this.data.rent_min", typeof this.data.rent_min); this.triggerEvent('submit', { rent_min: this.data.rent_min, rent_max: this.data.rent_max }) this.setData({ show: false }) }, clear() { if (this.data.rent_min || this.data.rent_max) { this.setData({ rent_max: '', rent_min: "" }) wx.showToast({ title: '已清空', }) } else { this.setData({ show: false }) } }, close() { this.setData({ show: false }) } } })