Commit e2c6ff2b67f5b098a3f5b693f0faaf6a7c4e69c6
1 parent
743d0278
update Rate
update Rate @huixisheng
Showing
3 changed files
with
19 additions
and
51 deletions
Show diff stats
src/components/rate/rate.vue
@@ -48,15 +48,9 @@ | @@ -48,15 +48,9 @@ | ||
48 | hoverIndex: -1, | 48 | hoverIndex: -1, |
49 | isHover: false, | 49 | isHover: false, |
50 | isHalf: false, | 50 | isHalf: false, |
51 | - currentValue: 0 | 51 | + currentValue: this.value |
52 | }; | 52 | }; |
53 | }, | 53 | }, |
54 | - // created () { | ||
55 | - // this.currentValue = this.value; | ||
56 | - // this.setHalf(this.currentValue); | ||
57 | - // }, | ||
58 | - mounted () { | ||
59 | - }, | ||
60 | computed: { | 54 | computed: { |
61 | classes () { | 55 | classes () { |
62 | return [ | 56 | return [ |
@@ -68,26 +62,12 @@ | @@ -68,26 +62,12 @@ | ||
68 | } | 62 | } |
69 | }, | 63 | }, |
70 | watch: { | 64 | watch: { |
71 | - value: { | ||
72 | - immediate: true, | ||
73 | - handler (val) { | ||
74 | - this.currentValue = val; | ||
75 | - } | 65 | + value (val) { |
66 | + this.currentValue = val; | ||
76 | }, | 67 | }, |
77 | - // valur (val) { | ||
78 | - // console.log(val); | ||
79 | - // this.currentValue = val; | ||
80 | - // console.log(this.currentValue); | ||
81 | - // }, | ||
82 | - currentValue: { | ||
83 | - immediate: true, | ||
84 | - handler () { | ||
85 | - this.setHalf(this.currentValue); | ||
86 | - } | 68 | + currentValue (val) { |
69 | + this.setHalf(val); | ||
87 | } | 70 | } |
88 | - // currentValue () { | ||
89 | - // this.setHalf(this.currentValue); | ||
90 | - // } | ||
91 | }, | 71 | }, |
92 | methods: { | 72 | methods: { |
93 | starCls (value) { | 73 | starCls (value) { |
@@ -138,13 +118,13 @@ | @@ -138,13 +118,13 @@ | ||
138 | }, | 118 | }, |
139 | handleClick (value) { | 119 | handleClick (value) { |
140 | if (this.disabled) return; | 120 | if (this.disabled) return; |
141 | - // value++; | 121 | +// value++; |
142 | if (this.isHalf) value -= 0.5; | 122 | if (this.isHalf) value -= 0.5; |
143 | this.currentValue = value; | 123 | this.currentValue = value; |
144 | - this.$emit('on-change', this.currentValue); | ||
145 | - this.$emit('input', this.currentValue); | 124 | + this.$emit('input', value); |
125 | + this.$emit('on-change', value); | ||
146 | // @todo | 126 | // @todo |
147 | - // this.$dispatch('on-form-change', value); | 127 | +// this.$dispatch('on-form-change', value); |
148 | } | 128 | } |
149 | } | 129 | } |
150 | }; | 130 | }; |
src/components/tree/tree.vue
@@ -30,14 +30,14 @@ | @@ -30,14 +30,14 @@ | ||
30 | import Icon from '../icon/icon.vue'; | 30 | import Icon from '../icon/icon.vue'; |
31 | import Checkbox from '../checkbox/checkbox.vue'; | 31 | import Checkbox from '../checkbox/checkbox.vue'; |
32 | import { t } from '../../locale'; | 32 | import { t } from '../../locale'; |
33 | - import emitter from '../../mixins/emitter'; | 33 | + import Emitter from '../../mixins/emitter'; |
34 | 34 | ||
35 | const prefixCls = 'ivu-tree'; | 35 | const prefixCls = 'ivu-tree'; |
36 | 36 | ||
37 | export default { | 37 | export default { |
38 | name: 'Tree', | 38 | name: 'Tree', |
39 | components: { Icon, Checkbox }, | 39 | components: { Icon, Checkbox }, |
40 | - mixins: [ emitter ], | 40 | + mixins: [ Emitter ], |
41 | props: { | 41 | props: { |
42 | value: { | 42 | value: { |
43 | type: Array, | 43 | type: Array, |
test/routers/rate.vue
1 | <template> | 1 | <template> |
2 | - <Row> | ||
3 | - <i-col span="12"> | ||
4 | - <Rate show-text :value="valueText"></Rate> | ||
5 | - </i-col> | ||
6 | - <i-col span="12"> | ||
7 | - <Rate show-text v-model="valueCustomText" > | ||
8 | - <span style="color: #f5a623">{{ valueCustomText }}</span> | ||
9 | - </Rate> | ||
10 | - </i-col> | ||
11 | - <i-col span="12"> | ||
12 | - <Rate disabled :value="valueDisabled"></Rate> | ||
13 | - </i-col> | ||
14 | - <i-col span="12"> | ||
15 | - <Rate allow-half :value="valueHalf" v-on:on-change="changeValue"></Rate> | ||
16 | - </i-col> | ||
17 | - </Row> | 2 | + <div> |
3 | + <Rate v-model="v1" allow-half show-text disabled> | ||
4 | + <span style="color: #f5a623">{{ v1 }}</span> | ||
5 | + </Rate> | ||
6 | + {{ v1 }} | ||
7 | + <div @click="v1 = 3">change v1</div> | ||
8 | + </div> | ||
18 | </template> | 9 | </template> |
19 | <script> | 10 | <script> |
20 | export default { | 11 | export default { |
21 | props: {}, | 12 | props: {}, |
22 | data () { | 13 | data () { |
23 | return { | 14 | return { |
24 | - valueText: 3, | ||
25 | - valueCustomText: 3.8, | ||
26 | - valueDisabled: 2, | ||
27 | - valueHalf: 2.5 | 15 | + v1: 2 |
28 | }; | 16 | }; |
29 | }, | 17 | }, |
30 | computed: {}, | 18 | computed: {}, |