Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Commit 2078edd

Browse files
committed
fix: resolve some properties absency
1 parent c38eaa0 commit 2078edd

File tree

3 files changed

+60
-3
lines changed

3 files changed

+60
-3
lines changed

examples/view/components/form/slider.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,28 @@
77

88
<KView class="page__bd page__bd_spacing">
99
<KSlider/>
10-
<KSlider :show-value="true" />
10+
<KSlider
11+
:show-value="true"
12+
v-model="slider1"
13+
@change="change" />
1114
</KView>
1215

1316
</KView>
1417

1518
</template>
1619

20+
<script>
21+
export default {
22+
data() {
23+
return {
24+
slider1: 10
25+
}
26+
},
27+
methods: {
28+
change() {
29+
console.log(this.slider1)
30+
}
31+
}
32+
}
33+
</script>
34+

packages/KForm/KSlider.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ export default {
224224
},
225225
getBlockSize(value){
226226
return getLimitNumber(value, 12, 28)
227+
},
228+
sliderChange(event){
229+
this.$emit('input',event.detail.value)
230+
this.$emit('change',event)
231+
},
232+
sliderChanging(event){
233+
this.$emit('input',event.detail.value)
234+
this.$emit('changing',event)
227235
}
228236
}
229237
};

packages/KSwiper/KSwiper.vue

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
<template>
22
<wx-swiper
33
v-if="ismp"
4-
4+
:autoplay="autoplay"
5+
:current="current"
6+
:interval="interval"
7+
:duration="duration"
8+
:circular="circular"
9+
:vertical="vertical"
10+
:indicator-dots="indicatorDots"
11+
:indicator-color="indicatorColor"
12+
:indicator-active-color="indicatorActiveColor"
13+
:previous-margin="previousMargin"
14+
:next-margin="nextMargin"
15+
:easing-function="easingFunction"
16+
:display-multiple-items="displayMultipleItems"
17+
:skip-hidden-item-layout="skipHiddenItemLayout"
18+
@change="itemChange"
19+
@transition="transitionChange"
20+
@animationfinish="animationfinish"
521
>
622
<slot></slot>
723
</wx-swiper>
@@ -67,6 +83,10 @@ export default {
6783
type: Number,
6884
default: 500,
6985
},
86+
value: {
87+
type: Number,
88+
default: 0
89+
},
7090
current: {
7191
type: Number,
7292
default: 0,
@@ -120,7 +140,7 @@ export default {
120140
ddx: 0, // 和前一个 move 位置的差值
121141
ddy: 0
122142
},
123-
currentOrder: this.current,
143+
currentOrder: this.value || this.current,
124144
contentTrackViewport: 0,
125145
viewportPosition: 0,
126146
contentTrackT: 0,
@@ -147,6 +167,7 @@ export default {
147167
currentOrder(newValue,oldValue){
148168
if(newValue !== oldValue){
149169
this.$emit('change',newValue)
170+
this.$emit('input',newValue)
150171
}
151172
}
152173
},
@@ -634,6 +655,16 @@ export default {
634655
635656
// 更新一下 dots 内容
636657
// this._updateDots(position)
658+
},
659+
itemChange(event){
660+
this.$emit('input',event.detail.current)
661+
this.$emit('change',event)
662+
},
663+
transitionChange(event){
664+
this.$emit('transition',event)
665+
},
666+
animationfinish(event){
667+
this.$emit('animationfinish',event)
637668
}
638669
639670
},

0 commit comments

Comments
 (0)