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 | 48 | hoverIndex: -1, |
| 49 | 49 | isHover: false, |
| 50 | 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 | 54 | computed: { |
| 61 | 55 | classes () { |
| 62 | 56 | return [ |
| ... | ... | @@ -68,26 +62,12 @@ |
| 68 | 62 | } |
| 69 | 63 | }, |
| 70 | 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 | 72 | methods: { |
| 93 | 73 | starCls (value) { |
| ... | ... | @@ -138,13 +118,13 @@ |
| 138 | 118 | }, |
| 139 | 119 | handleClick (value) { |
| 140 | 120 | if (this.disabled) return; |
| 141 | - // value++; | |
| 121 | +// value++; | |
| 142 | 122 | if (this.isHalf) value -= 0.5; |
| 143 | 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 | 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 | 30 | import Icon from '../icon/icon.vue'; |
| 31 | 31 | import Checkbox from '../checkbox/checkbox.vue'; |
| 32 | 32 | import { t } from '../../locale'; |
| 33 | - import emitter from '../../mixins/emitter'; | |
| 33 | + import Emitter from '../../mixins/emitter'; | |
| 34 | 34 | |
| 35 | 35 | const prefixCls = 'ivu-tree'; |
| 36 | 36 | |
| 37 | 37 | export default { |
| 38 | 38 | name: 'Tree', |
| 39 | 39 | components: { Icon, Checkbox }, |
| 40 | - mixins: [ emitter ], | |
| 40 | + mixins: [ Emitter ], | |
| 41 | 41 | props: { |
| 42 | 42 | value: { |
| 43 | 43 | type: Array, | ... | ... |
test/routers/rate.vue
| 1 | 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 | 9 | </template> |
| 19 | 10 | <script> |
| 20 | 11 | export default { |
| 21 | 12 | props: {}, |
| 22 | 13 | data () { |
| 23 | 14 | return { |
| 24 | - valueText: 3, | |
| 25 | - valueCustomText: 3.8, | |
| 26 | - valueDisabled: 2, | |
| 27 | - valueHalf: 2.5 | |
| 15 | + v1: 2 | |
| 28 | 16 | }; |
| 29 | 17 | }, |
| 30 | 18 | computed: {}, | ... | ... |