This commit is contained in:
梁灏 2017-09-04 15:42:18 +08:00
parent 322960e090
commit b324bb4d2e
2 changed files with 14 additions and 15 deletions

View file

@ -1,25 +1,24 @@
<template>
<div>
<Rate v-model="v1" allow-half show-text disabled>
<span style="color: #f5a623">{{ v1 }}</span>
<Rate v-model="value"></Rate>
<Rate allow-half v-model="valueHalf"></Rate>
<Rate show-text v-model="valueText"></Rate>
<Rate show-text allow-half v-model="valueCustomText">
<span style="color: #f5a623">{{ valueCustomText }}</span>
</Rate>
{{ v1 }}
<div @click="v1 = 3">change v1</div>
<Rate disabled allow-half v-model="valueDisabled"></Rate>
</div>
</template>
<script>
export default {
props: {},
data () {
return {
v1: 2
};
},
computed: {},
methods: {
changeValue (val) {
console.log(val);
value: 0,
valueHalf: 2.5,
valueText: 3,
valueCustomText: 3.8,
valueDisabled: 2.4
}
}
};
</script>
}
</script>

View file

@ -47,7 +47,7 @@
prefixCls: prefixCls,
hoverIndex: -1,
isHover: false,
isHalf: this.allowHalf && this.value % 1 == 0.5,
isHalf: this.allowHalf && this.value.toString().indexOf('.') >= 0,
currentValue: this.value
};
},