You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.3 KiB
JavaScript

// components/slider-component/index.js
Component({
properties: {
slider_min: {
//最小值
type: Number,
value: 0,
},
slider_max: {
//最大值
type: Number,
value: 100,
},
slider_value: {
//当前值
type: Number,
value: 10,
},
show_value: {
//当前值
type: Number,
value: 10,
},
// age: {
// //当前值
// type: Number,
// value: true,
// },
},
ready() {
console.log(this.properties.slider_min);
console.log(this.properties.slider_max);
console.log(this.properties.slider_value);
},
methods: {
sliderChanging(e) {
// console.log(this.properties);
const value = e.detail.value;
if (value >= 16) {
this.properties.show_value = value;
}
// wx.vibrateShort({
// type: "heavy",
// success: function (e) {},
// });
// console.log(this.properties.slider_value);
// this.triggerEvent("sliderchange", value);
this.triggerEvent("showchange", this.properties.show_value);
},
sliderChange(e){
const value = e.detail.value;
if (value >= 16) {
this.properties.show_value = value;
}
// console.log(this.properties.slider_value);
this.triggerEvent("sliderchange", value);
// this.triggerEvent("showchange", this.properties.show_value);
}
},
});