index.js 554 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. var _page = _interopRequireDefault(require("../../common/page"));
  3. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4. var format = function format(rate) {
  5. return Math.min(Math.max(rate, 0), 100);
  6. };
  7. (0, _page["default"])({
  8. data: {
  9. value: 25,
  10. gradientColor: {
  11. "0%": "#ffd01e",
  12. "100%": "#ee0a24"
  13. }
  14. },
  15. run: function run(e) {
  16. var step = parseFloat(e.currentTarget.dataset.step);
  17. this.setData({
  18. value: format(this.data.value += step)
  19. });
  20. }
  21. });