2019-09-09 14:44:33 +08:00

20 lines
360 B
JavaScript

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