update Rate

update Rate
This commit is contained in:
梁灏 2017-01-17 15:49:34 +08:00
parent 962c40bd3d
commit e5ac79258a
8 changed files with 32 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 162 KiB

View file

@ -7,12 +7,18 @@
@click="handleClick(item)">
<span :class="[prefixCls + '-star-content']" type="half"></span>
</div>
<div :class="[prefixCls + '-text']" v-if="showText">
<slot>{{ value }} <template v-if="value <= 1">{{ t('i.rate.star') }}</template><template v-else>{{ t('i.rate.stars') }}</template></slot>
</div>
</div>
</template>
<script>
import Locale from '../../mixins/locale';
const prefixCls = 'ivu-rate';
export default {
mixins: [ Locale ],
props: {
count: {
type: Number,
@ -29,6 +35,10 @@
disabled: {
type: Boolean,
default: false
},
showText: {
type: Boolean,
default: false
}
},
data () {

View file

@ -83,6 +83,10 @@ export default {
page: '/page',
goto: 'Goto',
p: ''
},
rate: {
star: 'Star',
stars: 'Stars'
}
}
};

View file

@ -83,6 +83,10 @@ export default {
page: '条/页',
goto: '跳至',
p: '页'
},
rate: {
star: '星',
stars: '星'
}
}
};

View file

@ -83,6 +83,10 @@ export default {
page: '條/頁',
goto: '跳至',
p: '頁'
},
rate: {
star: '星',
stars: '星'
}
}
};

View file

@ -8,7 +8,6 @@
vertical-align: middle;
font-weight: normal;
font-style: normal;
font-family: 'Ionicons';
&-disabled &-star {
&:before,
@ -26,6 +25,7 @@
padding: 0;
margin-right: 8px;
position: relative;
font-family: 'Ionicons';
transition: all 0.3s ease;
&:hover {
@ -63,4 +63,10 @@
color: tint(@rate-star-color, 20%);
}
}
&-text {
margin-left: 8px;
vertical-align: middle;
display: inline-block;
font-size: @font-size-small;
}
}

View file

@ -6,9 +6,10 @@ import VueRouter from 'vue-router';
import App from './app.vue';
import iView from '../src/index';
// import locale from '../src/locale/lang/en-US';
import locale from '../src/locale/lang/zh-CN';
Vue.use(VueRouter);
Vue.use(iView);
Vue.use(iView, { locale });
// 开启debug模式
Vue.config.debug = true;

View file

@ -2,7 +2,7 @@
<div style="margin: 100px">
{{value}}
<br><br><br>
<Rate :value.sync="value" :count="5" allow-half></Rate>
<Rate :value.sync="value" :count="5" allow-half show-text></Rate>
<br><br><br>
<i-button @click="value++">add</i-button>
<i-button @click="value--">remove</i-button>