update Rate
update Rate @huixisheng
This commit is contained in:
parent
743d027897
commit
e2c6ff2b67
3 changed files with 19 additions and 51 deletions
|
@ -48,15 +48,9 @@
|
|||
hoverIndex: -1,
|
||||
isHover: false,
|
||||
isHalf: false,
|
||||
currentValue: 0
|
||||
currentValue: this.value
|
||||
};
|
||||
},
|
||||
// created () {
|
||||
// this.currentValue = this.value;
|
||||
// this.setHalf(this.currentValue);
|
||||
// },
|
||||
mounted () {
|
||||
},
|
||||
computed: {
|
||||
classes () {
|
||||
return [
|
||||
|
@ -68,26 +62,12 @@
|
|||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
immediate: true,
|
||||
handler (val) {
|
||||
this.currentValue = val;
|
||||
}
|
||||
value (val) {
|
||||
this.currentValue = val;
|
||||
},
|
||||
// valur (val) {
|
||||
// console.log(val);
|
||||
// this.currentValue = val;
|
||||
// console.log(this.currentValue);
|
||||
// },
|
||||
currentValue: {
|
||||
immediate: true,
|
||||
handler () {
|
||||
this.setHalf(this.currentValue);
|
||||
}
|
||||
currentValue (val) {
|
||||
this.setHalf(val);
|
||||
}
|
||||
// currentValue () {
|
||||
// this.setHalf(this.currentValue);
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
starCls (value) {
|
||||
|
@ -138,13 +118,13 @@
|
|||
},
|
||||
handleClick (value) {
|
||||
if (this.disabled) return;
|
||||
// value++;
|
||||
// value++;
|
||||
if (this.isHalf) value -= 0.5;
|
||||
this.currentValue = value;
|
||||
this.$emit('on-change', this.currentValue);
|
||||
this.$emit('input', this.currentValue);
|
||||
this.$emit('input', value);
|
||||
this.$emit('on-change', value);
|
||||
// @todo
|
||||
// this.$dispatch('on-form-change', value);
|
||||
// this.$dispatch('on-form-change', value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -30,14 +30,14 @@
|
|||
import Icon from '../icon/icon.vue';
|
||||
import Checkbox from '../checkbox/checkbox.vue';
|
||||
import { t } from '../../locale';
|
||||
import emitter from '../../mixins/emitter';
|
||||
import Emitter from '../../mixins/emitter';
|
||||
|
||||
const prefixCls = 'ivu-tree';
|
||||
|
||||
export default {
|
||||
name: 'Tree',
|
||||
components: { Icon, Checkbox },
|
||||
mixins: [ emitter ],
|
||||
mixins: [ Emitter ],
|
||||
props: {
|
||||
value: {
|
||||
type: Array,
|
||||
|
|
|
@ -1,30 +1,18 @@
|
|||
<template>
|
||||
<Row>
|
||||
<i-col span="12">
|
||||
<Rate show-text :value="valueText"></Rate>
|
||||
</i-col>
|
||||
<i-col span="12">
|
||||
<Rate show-text v-model="valueCustomText" >
|
||||
<span style="color: #f5a623">{{ valueCustomText }}</span>
|
||||
</Rate>
|
||||
</i-col>
|
||||
<i-col span="12">
|
||||
<Rate disabled :value="valueDisabled"></Rate>
|
||||
</i-col>
|
||||
<i-col span="12">
|
||||
<Rate allow-half :value="valueHalf" v-on:on-change="changeValue"></Rate>
|
||||
</i-col>
|
||||
</Row>
|
||||
<div>
|
||||
<Rate v-model="v1" allow-half show-text disabled>
|
||||
<span style="color: #f5a623">{{ v1 }}</span>
|
||||
</Rate>
|
||||
{{ v1 }}
|
||||
<div @click="v1 = 3">change v1</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {},
|
||||
data () {
|
||||
return {
|
||||
valueText: 3,
|
||||
valueCustomText: 3.8,
|
||||
valueDisabled: 2,
|
||||
valueHalf: 2.5
|
||||
v1: 2
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
|
|
Loading…
Add table
Reference in a new issue