element-plus/docs/examples/rate/basic-usage.vue
2022-03-14 19:41:41 +08:00

39 lines
944 B
Vue

<template>
<div class="demo-rate-block">
<span class="demonstration">Default</span>
<el-rate v-model="value1" />
</div>
<div class="demo-rate-block">
<span class="demonstration">Color for different levels</span>
<el-rate v-model="value2" :colors="colors" />
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const value1 = ref(null)
const value2 = ref(null)
const colors = ref(['#99A9BF', '#F7BA2A', '#FF9900']) // same as { 2: '#99A9BF', 4: { value: '#F7BA2A', excluded: true }, 5: '#FF9900' }
</script>
<style scoped>
.demo-rate-block {
padding: 30px 0;
text-align: center;
border-right: solid 1px var(--el-border-color);
display: inline-block;
width: 49%;
box-sizing: border-box;
}
.demo-rate-block:last-child {
border-right: none;
}
.demo-rate-block .demonstration {
display: block;
color: var(--el-text-color-secondary);
font-size: 14px;
margin-bottom: 20px;
}
</style>