Commit b324bb4d2e19b106833bb03a0b4e67630b99fa0b

Authored by 梁灏
1 parent 322960e0

fixed #1761

Showing 2 changed files with 14 additions and 15 deletions   Show diff stats
examples/routers/rate.vue
1 1 <template>
2 2 <div>
3   - <Rate v-model="v1" allow-half show-text disabled>
4   - <span style="color: #f5a623">{{ v1 }}</span>
  3 + <Rate v-model="value"></Rate>
  4 + <Rate allow-half v-model="valueHalf"></Rate>
  5 + <Rate show-text v-model="valueText"></Rate>
  6 + <Rate show-text allow-half v-model="valueCustomText">
  7 + <span style="color: #f5a623">{{ valueCustomText }}</span>
5 8 </Rate>
6   - {{ v1 }}
7   - <div @click="v1 = 3">change v1</div>
  9 + <Rate disabled allow-half v-model="valueDisabled"></Rate>
8 10 </div>
9 11 </template>
10 12 <script>
11 13 export default {
12   - props: {},
13 14 data () {
14 15 return {
15   - v1: 2
16   - };
17   - },
18   - computed: {},
19   - methods: {
20   - changeValue (val) {
21   - console.log(val);
  16 + value: 0,
  17 + valueHalf: 2.5,
  18 + valueText: 3,
  19 + valueCustomText: 3.8,
  20 + valueDisabled: 2.4
22 21 }
23 22 }
24   - };
25   -</script>
26 23 \ No newline at end of file
  24 + }
  25 +</script>
... ...
src/components/rate/rate.vue
... ... @@ -47,7 +47,7 @@
47 47 prefixCls: prefixCls,
48 48 hoverIndex: -1,
49 49 isHover: false,
50   - isHalf: this.allowHalf && this.value % 1 == 0.5,
  50 + isHalf: this.allowHalf && this.value.toString().indexOf('.') >= 0,
51 51 currentValue: this.value
52 52 };
53 53 },
... ...