mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(Rate): add touchable prop
This commit is contained in:
parent
c0901b8023
commit
0b2a4092f9
@ -39,6 +39,7 @@
|
|||||||
color="#ee0a24"
|
color="#ee0a24"
|
||||||
void-color="#eee"
|
void-color="#eee"
|
||||||
void-icon="star"
|
void-icon="star"
|
||||||
|
touchable="{{ false }}"
|
||||||
bind:change="onChange"
|
bind:change="onChange"
|
||||||
/>
|
/>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
@ -118,6 +118,7 @@ Page({
|
|||||||
| readonly | 是否为只读状态 | *boolean* | `false` | - |
|
| readonly | 是否为只读状态 | *boolean* | `false` | - |
|
||||||
| disabled | 是否禁用评分 | *boolean* | `false` | - |
|
| disabled | 是否禁用评分 | *boolean* | `false` | - |
|
||||||
| disabled-color | 禁用时的颜色 | *string* | `#bdbdbd` | - |
|
| disabled-color | 禁用时的颜色 | *string* | `#bdbdbd` | - |
|
||||||
|
| touchable | 是否可以通过滑动手势选择评分 | *boolean* | `true` | - |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -44,6 +44,10 @@ VantComponent({
|
|||||||
type: null,
|
type: null,
|
||||||
observer: 'setGutterWithUnit'
|
observer: 'setGutterWithUnit'
|
||||||
},
|
},
|
||||||
|
touchable: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
@ -84,6 +88,9 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onTouchMove(event: Weapp.TouchEvent) {
|
onTouchMove(event: Weapp.TouchEvent) {
|
||||||
|
const { touchable } = this.data;
|
||||||
|
if (!touchable) return;
|
||||||
|
|
||||||
const { clientX, clientY } = event.touches[0];
|
const { clientX, clientY } = event.touches[0];
|
||||||
|
|
||||||
this.getRect('.van-rate__icon', true).then(
|
this.getRect('.van-rate__icon', true).then(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user