|
| 1 | +<template> |
| 2 | + <div class="lin-container"> |
| 3 | + <div class="lin-title">Rate 评分</div> |
| 4 | + <div class="lin-wrap-ui"> |
| 5 | + <el-card style="margin-bottom:50px;"> |
| 6 | + <div slot="header"> |
| 7 | + <span>基础用法</span> |
| 8 | + </div> |
| 9 | + <el-row> |
| 10 | + <div class="block"> |
| 11 | + <span class="demonstration">默认不区分颜色</span> |
| 12 | + <el-rate v-model="value1" :colors="colors1" :max="6"></el-rate> |
| 13 | + </div> |
| 14 | + <div class="block"> |
| 15 | + <span class="demonstration">区分颜色</span> |
| 16 | + <el-rate v-model="value2" :colors="colors2"></el-rate> |
| 17 | + </div> |
| 18 | + </el-row> |
| 19 | + |
| 20 | + <el-collapse> |
| 21 | + <el-collapse-item title="查看代码" name="2"> |
| 22 | + <div style="white-space: pre-wrap;">{{base}}</div> |
| 23 | + </el-collapse-item> |
| 24 | + </el-collapse> |
| 25 | + </el-card> |
| 26 | + |
| 27 | + <el-card style="margin-bottom:50px;"> |
| 28 | + <div slot="header"> |
| 29 | + <span>辅助文字</span> |
| 30 | + </div> |
| 31 | + <el-row> |
| 32 | + <el-rate |
| 33 | + v-model="value3" |
| 34 | + show-text |
| 35 | + :texts="texts" |
| 36 | + :colors="colors3"> |
| 37 | + </el-rate> |
| 38 | + </el-row> |
| 39 | + |
| 40 | + <el-collapse> |
| 41 | + <el-collapse-item title="查看代码" name="2"> |
| 42 | + <div style="white-space: pre-wrap;">{{withText}}</div> |
| 43 | + </el-collapse-item> |
| 44 | + </el-collapse> |
| 45 | + </el-card> |
| 46 | + |
| 47 | + <el-card style="margin-bottom:50px;"> |
| 48 | + <div slot="header"> |
| 49 | + <span>只读</span> |
| 50 | + </div> |
| 51 | + <el-row> |
| 52 | + <el-rate |
| 53 | + v-model="value4" |
| 54 | + disabled |
| 55 | + show-score |
| 56 | + text-color="#ff9900" |
| 57 | + score-template="{value}分"> |
| 58 | + </el-rate> |
| 59 | + </el-row> |
| 60 | + |
| 61 | + <el-collapse> |
| 62 | + <el-collapse-item title="查看代码" name="2"> |
| 63 | + <div style="white-space: pre-wrap;">{{disabled}}</div> |
| 64 | + </el-collapse-item> |
| 65 | + </el-collapse> |
| 66 | + </el-card> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | +</template> |
| 70 | + |
| 71 | +<script> |
| 72 | +export default { |
| 73 | + data() { |
| 74 | + return { |
| 75 | + value1: null, |
| 76 | + value2: null, |
| 77 | + value3: null, |
| 78 | + value4: 3.7, |
| 79 | + colors1: { 6: '#FFBE4D' }, |
| 80 | + colors2: { 2: '#8C98AE', 4: { value: '#FFDD55', excluded: true }, 5: '#FFBE4D' }, |
| 81 | + colors3: { 5: '#FFDD55' }, |
| 82 | + texts: ['极差', '失望', '一般', '满意', '惊喜'], |
| 83 | + iconClasses: { 2: 'icon-rate-face-1', 4: { value: 'icon-rate-face-2', excluded: true }, 5: 'icon-rate-face-3' }, |
| 84 | + base: ` |
| 85 | + <el-rate v-model="value1" :colors="colors1" :max="6"></el-rate> |
| 86 | + <el-rate v-model="value2" :colors="colors2"></el-rate>`, |
| 87 | + withText: ` |
| 88 | + <el-rate v-model="value3" show-text :texts="texts" :colors="colors3"> |
| 89 | + </el-rate>`, |
| 90 | + disabled: ` |
| 91 | + <el-rate |
| 92 | + v-model="value4" |
| 93 | + disabled |
| 94 | + show-score |
| 95 | + text-color="#ff9900" |
| 96 | + score-template="{value}分"> |
| 97 | + </el-rate>`, |
| 98 | + } |
| 99 | + }, |
| 100 | + components: { |
| 101 | +
|
| 102 | + }, |
| 103 | +} |
| 104 | +</script> |
| 105 | + |
| 106 | +<style lang="scss" scoped> |
| 107 | +@import '../../assets/style/container.scss'; |
| 108 | +
|
| 109 | +.block { |
| 110 | + padding: 30px 0; |
| 111 | + text-align: center; |
| 112 | + border-right: 1px solid #eff2f6; |
| 113 | + display: inline-block; |
| 114 | + width: 49%; |
| 115 | + box-sizing: border-box; |
| 116 | +
|
| 117 | + &:last-child { |
| 118 | + border-right: none; |
| 119 | + } |
| 120 | +} |
| 121 | +
|
| 122 | +.demonstration { |
| 123 | + display: block; |
| 124 | + color: #8492a6; |
| 125 | + font-size: 14px; |
| 126 | + margin-bottom: 20px; |
| 127 | +} |
| 128 | +</style> |
0 commit comments