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

42 lines
1.1 KiB

9 months ago
  1. export default {
  2. data() {
  3. return {
  4. sliderRect: {},
  5. info: {
  6. width: null,
  7. left: null,
  8. step: this.step,
  9. disabled: this.disabled,
  10. min: this.min,
  11. max: this.max,
  12. value: this.value
  13. }
  14. }
  15. },
  16. mounted() {
  17. this.init()
  18. },
  19. methods: {
  20. init() {
  21. this.getSliderRect()
  22. },
  23. // 获取slider尺寸
  24. getSliderRect() {
  25. // 获取滑块条的尺寸信息
  26. uni.$u.sleep().then(() => {
  27. this.$uGetRect('.u-slider').then((rect) => {
  28. this.info.width = rect.width
  29. this.info.left = rect.left
  30. })
  31. })
  32. },
  33. // 此方法由wxs调用,用于修改v-model绑定的值
  34. updateValue(value) {
  35. this.$emit('input', value)
  36. },
  37. // 此方法由wxs调用,发出事件
  38. emitEvent(e) {
  39. this.$emit(e.event, e.value ? e.value : this.value)
  40. }
  41. }
  42. }