dykj-outsource-12123/uni_modules/uview-plus/components/u-slider/mpwxs.js
2024-06-28 14:18:30 +08:00

44 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { sleep } from '../../libs/function/index';
export default {
data() {
return {
sliderRect: {},
info: {
width: null,
left: null,
step: this.step,
disabled: this.disabled,
min: this.min,
max: this.max,
value: this.value
}
}
},
mounted() {
this.init()
},
methods: {
init() {
this.getSliderRect()
},
// 获取slider尺寸
getSliderRect() {
// 获取滑块条的尺寸信息
sleep().then(() => {
this.$uGetRect('.u-slider').then((rect) => {
this.info.width = rect.width
this.info.left = rect.left
})
})
},
// 此方法由wxs调用用于修改v-model绑定的值
updateValue(value) {
this.$emit('input', value)
},
// 此方法由wxs调用发出事件
emitEvent(e) {
this.$emit(e.event, e.value ? e.value : this.value)
}
}
}