2021-12-21 09:51:43 +08:00

23 lines
424 B
TypeScript

import { VantComponent } from '../../common/component';
const format = (rate) => Math.min(Math.max(rate, 0), 100);
VantComponent({
data: {
value: 25,
gradientColor: {
'0%': '#ffd01e',
'100%': '#ee0a24',
},
},
methods: {
run(e) {
const step = parseFloat(e.currentTarget.dataset.step);
this.setData({
value: format((this.data.value += step)),
});
},
},
});