File tree Expand file tree Collapse file tree 6 files changed +64
-29
lines changed Expand file tree Collapse file tree 6 files changed +64
-29
lines changed Original file line number Diff line number Diff line change 44 </a>
55</p >
66
7- # iView Weapp
7+ # iView mpvue
88
9- ### 一套高质量的微信小程序 UI 组件库
9+ ### 一套高质量的小程序 UI 组件库
1010
1111## 文档
1212[ https://weapp.iviewui.com ] ( https://weapp.iviewui.com )
Original file line number Diff line number Diff line change 66 :key =" index"
77 :data-index =" index"
88 :class =" [index < value ? 'i-rate-current' : '']"
9- class =" i-rate-star" >
9+ class =" i-rate-star"
10+ @click =" handleClick" >
1011 <i-icon type =" collection_fill" :size =" size" ></i-icon >
1112 </div >
12- <div class =" i-rate-text" v-if =" value" >< slot ></ slot > </div >
13+ <div class =" i-rate-text" v-if =" value && showText " >{{value}}{{showText}} </div >
1314 </div >
1415</template >
1516<script >
@@ -41,7 +42,11 @@ export default {
4142 },
4243 iClass: {
4344 type: String ,
44- default: ' dfsgdfg'
45+ default: ' '
46+ },
47+ showText: {
48+ type: String ,
49+ default: ' '
4550 }
4651 },
4752 data () {
@@ -72,8 +77,15 @@ export default {
7277 })
7378 },
7479 handleTouchMove (evt ) {
75- if (this .disabled || evt .mp .ch ) return
76-
80+ if (this .disabled || ! evt .mp .changedTouches [0 ]) return
81+ const movePageX = evt .mp .changedTouches [0 ].pageX
82+ const space = movePageX - this .touchesStart .pageX
83+ if (space <= 0 ) {
84+ return
85+ }
86+ let setIndex = Math .ceil (space / this .size )
87+ setIndex = setIndex > this .count ? this .count : setIndex
88+ this .$emit (' change' , {index: setIndex})
7789 }
7890 }
7991}
Original file line number Diff line number Diff line change 3636 " pages/radio/main" ,
3737 " pages/checkbox/main" ,
3838 " pages/switch/main" ,
39- " pages/rate/main" ,
40- " pages/input-number/main" ],
39+ " pages/rate/main" ],
4140 "window" : {
4241 "backgroundTextStyle" : " light" ,
4342 "navigationBarBackgroundColor" : " #fff" ,
Original file line number Diff line number Diff line change 66 :key =" index"
77 :data-index =" index"
88 :class =" [index < value ? 'i-rate-current' : '']"
9- class =" i-rate-star" >
9+ class =" i-rate-star"
10+ @click =" handleClick" >
1011 <i-icon type =" collection_fill" :size =" size" ></i-icon >
1112 </div >
12- <div class =" i-rate-text" v-if =" value" >< slot ></ slot > </div >
13+ <div class =" i-rate-text" v-if =" value && showText " >{{value}}{{showText}} </div >
1314 </div >
1415</template >
1516<script >
@@ -41,7 +42,11 @@ export default {
4142 },
4243 iClass: {
4344 type: String ,
44- default: ' dfsgdfg'
45+ default: ' '
46+ },
47+ showText: {
48+ type: String ,
49+ default: ' '
4550 }
4651 },
4752 data () {
@@ -72,8 +77,15 @@ export default {
7277 })
7378 },
7479 handleTouchMove (evt ) {
75- if (this .disabled || evt .mp .ch ) return
76-
80+ if (this .disabled || ! evt .mp .changedTouches [0 ]) return
81+ const movePageX = evt .mp .changedTouches [0 ].pageX
82+ const space = movePageX - this .touchesStart .pageX
83+ if (space <= 0 ) {
84+ return
85+ }
86+ let setIndex = Math .ceil (space / this .size )
87+ setIndex = setIndex > this .count ? this .count : setIndex
88+ this .$emit (' change' , {index: setIndex})
7789 }
7890 }
7991}
Original file line number Diff line number Diff line change 2424 <i-cell title =" 自定义文字说明" >
2525 <i-rate
2626 @change =" onChange2"
27- :value =" starIndex2" >
28- {{starIndex2}}星
27+ :value =" starIndex2"
28+ show-text = " 星 " >
2929 </i-rate >
3030 </i-cell >
3131 <i-cell title =" 手势touch选择星" >
3232 <i-rate
3333 @change =" onChange3"
34- :value =" starIndex3" >
35- {{starIndex3}}星
34+ :value =" starIndex3"
35+ show-text = " 星 " >
3636 </i-rate >
3737 </i-cell >
3838 <i-cell title =" 禁用点击和手势选择星" >
3939 <i-rate
4040 :disabled =" true"
41- :value =" starIndex4" >
42- {{starIndex4}}星
41+ :value =" starIndex4"
42+ show-text = " 星 " >
4343 </i-rate >
4444 </i-cell >
4545 </i-cell-group >
@@ -66,16 +66,16 @@ export default {
6666 },
6767 methods: {
6868 onChange1 (e ) {
69-
69+ this . starIndex1 = e . index
7070 },
7171 onChange2 (e ) {
72-
72+ this . starIndex2 = e . index
7373 },
7474 onChange3 (e ) {
75-
75+ this . starIndex3 = e . index
7676 },
7777 onChange5 (e ) {
78-
78+ this . starIndex5 = e . index
7979 }
8080 }
8181}
Original file line number Diff line number Diff line change 66 :key =" index"
77 :data-index =" index"
88 :class =" [index < value ? 'i-rate-current' : '']"
9- class =" i-rate-star" >
9+ class =" i-rate-star"
10+ @click =" handleClick" >
1011 <i-icon type =" collection_fill" :size =" size" ></i-icon >
1112 </div >
12- <div class =" i-rate-text" v-if =" value" >< slot ></ slot > </div >
13+ <div class =" i-rate-text" v-if =" value && showText " >{{value}}{{showText}} </div >
1314 </div >
1415</template >
1516<script >
@@ -41,7 +42,11 @@ export default {
4142 },
4243 iClass: {
4344 type: String ,
44- default: ' dfsgdfg'
45+ default: ' '
46+ },
47+ showText: {
48+ type: String ,
49+ default: ' '
4550 }
4651 },
4752 data () {
@@ -72,8 +77,15 @@ export default {
7277 })
7378 },
7479 handleTouchMove (evt ) {
75- if (this .disabled || evt .mp .ch ) return
76-
80+ if (this .disabled || ! evt .mp .changedTouches [0 ]) return
81+ const movePageX = evt .mp .changedTouches [0 ].pageX
82+ const space = movePageX - this .touchesStart .pageX
83+ if (space <= 0 ) {
84+ return
85+ }
86+ let setIndex = Math .ceil (space / this .size )
87+ setIndex = setIndex > this .count ? this .count : setIndex
88+ this .$emit (' change' , {index: setIndex})
7789 }
7890 }
7991}
You can’t perform that action at this time.
0 commit comments