uview-plus组件库全面升级更新,订单结算判断支付方式是否可用代码调整,公众号关注二维码修改
This commit is contained in:
@@ -86,6 +86,10 @@ export const props = defineMixin({
|
||||
height: {
|
||||
type: String,
|
||||
default: () => defProps.slider.height
|
||||
}
|
||||
},
|
||||
innerStyle: {
|
||||
type: Object,
|
||||
default: () => defProps.slider.innerStyle
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -22,6 +22,7 @@ export default {
|
||||
disabled:false,
|
||||
blockStyle: {},
|
||||
useNative: false,
|
||||
height: '2px'
|
||||
height: '2px',
|
||||
innerStyle: {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
<view ref="u-slider-inner" class="u-slider-inner" @click="onClick"
|
||||
@onTouchStart="onTouchStart2($event, 1)" @touchmove="onTouchMove2($event, 1)"
|
||||
@touchend="onTouchEnd2($event, 1)" @touchcancel="onTouchEnd2($event, 1)"
|
||||
:class="[disabled ? 'u-slider--disabled' : '']" :style="{
|
||||
height: (isRange && showValue) ? (getPx(blockSize) + 24) + 'px' : (getPx(blockSize)) + 'px',
|
||||
}"
|
||||
:class="[disabled ? 'u-slider--disabled' : '']" :style="innerStyleCpu"
|
||||
>
|
||||
<view ref="u-slider__base"
|
||||
class="u-slider__base"
|
||||
@@ -58,7 +56,7 @@
|
||||
<view class="u-slider__button-wrap u-slider__button-wrap-0" @touchstart="onTouchStart($event, 0)"
|
||||
@touchmove="onTouchMove($event, 0)" @touchend="onTouchEnd($event, 0)"
|
||||
@touchcancel="onTouchEnd($event, 0)" :style="{left: (getPx(barStyle0.width) + getPx(blockSize)/2) + 'px'}">
|
||||
<slot v-if="$slots.default || $slots.$default"/>
|
||||
<slot name="min" v-if="$slots.min || $slots.$min"/>
|
||||
<view v-else class="u-slider__button" :style="[blockStyle, {
|
||||
height: getPx(blockSize, true),
|
||||
width: getPx(blockSize, true),
|
||||
@@ -69,7 +67,8 @@
|
||||
<view class="u-slider__button-wrap" @touchstart="onTouchStart"
|
||||
@touchmove="onTouchMove" @touchend="onTouchEnd"
|
||||
@touchcancel="onTouchEnd" :style="{left: (getPx(barStyle.width) + getPx(blockSize)/2) + 'px'}">
|
||||
<slot v-if="$slots.default || $slots.$default"/>
|
||||
<slot name="max" v-if="isRange && ($slots.max || $slots.$max)"/>
|
||||
<slot v-else-if="$slots.default || $slots.$default"/>
|
||||
<view v-else class="u-slider__button" :style="[blockStyle, {
|
||||
height: getPx(blockSize, true),
|
||||
width: getPx(blockSize, true),
|
||||
@@ -148,20 +147,27 @@
|
||||
// #ifdef VUE3
|
||||
modelValue(n) {
|
||||
// 只有在非滑动状态时,才可以通过value更新滑块值,这里监听,是为了让用户触发
|
||||
if(this.status == 'end') this.updateValue(this.modelValue, false);
|
||||
if (this.status == 'end') {
|
||||
const $crtFmtValue = this.updateValue(this.modelValue, false);
|
||||
this.$emit('change', $crtFmtValue);
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE2
|
||||
value(n) {
|
||||
// 只有在非滑动状态时,才可以通过value更新滑块值,这里监听,是为了让用户触发
|
||||
if(this.status == 'end') this.updateValue(this.value, false);
|
||||
if (this.status == 'end') {
|
||||
const $crtFmtValue = this.updateValue(this.value, false);
|
||||
this.$emit('change', $crtFmtValue);
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
rangeValue:{
|
||||
handler(n){
|
||||
if(this.status == 'end'){
|
||||
if (this.status == 'end') {
|
||||
this.updateValue(this.rangeValue[0], false, 0);
|
||||
this.updateValue(this.rangeValue[1], false, 1);
|
||||
this.$emit('change', this.rangeValue);
|
||||
}
|
||||
},
|
||||
deep:true
|
||||
@@ -169,6 +175,13 @@
|
||||
},
|
||||
created() {
|
||||
},
|
||||
computed: {
|
||||
innerStyleCpu() {
|
||||
let style = this.innerStyle;
|
||||
style.height = (this.isRange && this.showValue) ? (getPx(this.blockSize) + 24) + 'px' : (getPx(this.blockSize)) + 'px';
|
||||
return style;
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
// 获取滑块条的尺寸信息
|
||||
if (!this.useNative) {
|
||||
@@ -386,7 +399,7 @@
|
||||
return this.rangeValue
|
||||
} else {
|
||||
return valueFormat
|
||||
}
|
||||
}
|
||||
},
|
||||
format(value, index = 1) {
|
||||
// 将小数变成整数,为了减少对视图的更新,造成视图层与逻辑层的阻塞
|
||||
@@ -419,7 +432,6 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "../../libs/css/components.scss";
|
||||
.u-slider {
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user