docs(Rate): add change event demo (#5596)

This commit is contained in:
Lindy
2020-01-19 17:43:09 +08:00
committed by neverland
parent a30bf27559
commit 8345d6e126
4 changed files with 66 additions and 1 deletions
+20 -1
View File
@@ -39,6 +39,13 @@
<demo-block :title="$t('readonly')">
<van-rate v-model="value6" readonly />
</demo-block>
<demo-block :title="$t('changeEvent')">
<van-rate
v-model="value7"
@change="onChange"
/>
</demo-block>
</demo-section>
</template>
@@ -52,6 +59,8 @@ export default {
customStyle: '自定义样式',
customCount: '自定义数量',
readonly: '只读状态',
changeEvent: '监听 change 事件',
toastContent: (value) => `当前值:${value}`
},
'en-US': {
halfStar: 'Half Star',
@@ -60,7 +69,9 @@ export default {
customStyle: 'Custom Style',
customCount: 'Custom Count',
readonly: 'Readonly',
},
changeEvent: 'Change Event',
toastContent: (value) => `current value${value}`
}
},
data() {
@@ -71,8 +82,16 @@ export default {
value4: 2.5,
value5: 4,
value6: 3,
value7: 2
};
},
methods: {
onChange(value) {
this.value7 = value;
this.$toast(this.$t('toastContent', value));
}
}
};
</script>