1
This commit is contained in:
113
uview-plus/components/u-slider/mpother.js
Normal file
113
uview-plus/components/u-slider/mpother.js
Normal file
File diff suppressed because it is too large
Load Diff
43
uview-plus/components/u-slider/mpwxs.js
Normal file
43
uview-plus/components/u-slider/mpwxs.js
Normal file
@@ -0,0 +1,43 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
121
uview-plus/components/u-slider/mpwxs.wxs
Normal file
121
uview-plus/components/u-slider/mpwxs.wxs
Normal file
File diff suppressed because it is too large
Load Diff
193
uview-plus/components/u-slider/nvue.js
Normal file
193
uview-plus/components/u-slider/nvue.js
Normal file
File diff suppressed because it is too large
Load Diff
91
uview-plus/components/u-slider/props.js
Normal file
91
uview-plus/components/u-slider/props.js
Normal file
@@ -0,0 +1,91 @@
|
||||
import { defineMixin } from '../../libs/vue'
|
||||
import defProps from '../../libs/config/props.js'
|
||||
|
||||
export const props = defineMixin({
|
||||
props: {
|
||||
// 最小可选值
|
||||
min: {
|
||||
type: [Number, String],
|
||||
default: () => defProps.slider.min
|
||||
},
|
||||
// 最大可选值
|
||||
max: {
|
||||
type: [Number, String],
|
||||
default: () => defProps.slider.max
|
||||
},
|
||||
// 步长,取值必须大于 0,并且可被(max - min)整除
|
||||
step: {
|
||||
type: [Number, String],
|
||||
default: () => defProps.slider.step
|
||||
},
|
||||
// #ifdef VUE3
|
||||
// 当前取值
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: () => defProps.slider.value
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE2
|
||||
// 当前取值
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: () => defProps.slider.value
|
||||
},
|
||||
// #endif
|
||||
// 是否区间模式
|
||||
isRange: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 双滑块时值
|
||||
rangeValue: {
|
||||
type: [Array],
|
||||
default: [0, 0]
|
||||
},
|
||||
// 滑块右侧已选择部分的背景色
|
||||
activeColor: {
|
||||
type: String,
|
||||
default: () => defProps.slider.activeColor
|
||||
},
|
||||
// 滑块左侧未选择部分的背景色
|
||||
inactiveColor: {
|
||||
type: String,
|
||||
default: () => defProps.slider.inactiveColor
|
||||
},
|
||||
// 滑块的大小,取值范围为 12 - 28
|
||||
blockSize: {
|
||||
type: [Number, String],
|
||||
default: () => defProps.slider.blockSize
|
||||
},
|
||||
// 滑块的颜色
|
||||
blockColor: {
|
||||
type: String,
|
||||
default: () => defProps.slider.blockColor
|
||||
},
|
||||
// 用户对滑块的自定义颜色
|
||||
blockStyle: {
|
||||
type: Object,
|
||||
default: () => defProps.slider.blockStyle
|
||||
},
|
||||
// 禁用状态
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: () => defProps.slider.disabled
|
||||
},
|
||||
// 是否显示当前的选择值
|
||||
showValue: {
|
||||
type: Boolean,
|
||||
default: () => defProps.slider.showValue
|
||||
},
|
||||
// 是否渲染uni-app框架内置组件
|
||||
useNative: {
|
||||
type: Boolean,
|
||||
default: () => defProps.slider.useNative
|
||||
},
|
||||
// 滑块高度
|
||||
height: {
|
||||
type: String,
|
||||
default: () => defProps.slider.height
|
||||
}
|
||||
}
|
||||
})
|
||||
27
uview-plus/components/u-slider/slider.js
Normal file
27
uview-plus/components/u-slider/slider.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* @Author : LQ
|
||||
* @Description :
|
||||
* @version : 1.0
|
||||
* @Date : 2021-08-20 16:44:21
|
||||
* @LastAuthor : LQ
|
||||
* @lastTime : 2021-08-20 17:08:25
|
||||
* @FilePath : /u-view2.0/uview-ui/libs/config/props/slider.js
|
||||
*/
|
||||
export default {
|
||||
// slider组件
|
||||
slider: {
|
||||
value: 0,
|
||||
blockSize: 18,
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 1,
|
||||
activeColor: '#2979ff',
|
||||
inactiveColor: '#c0c4cc',
|
||||
blockColor: '#ffffff',
|
||||
showValue: false,
|
||||
disabled:false,
|
||||
blockStyle: {},
|
||||
useNative: false,
|
||||
height: '2px'
|
||||
}
|
||||
}
|
||||
490
uview-plus/components/u-slider/u-slider.vue
Normal file
490
uview-plus/components/u-slider/u-slider.vue
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user