123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <template>
- <view class="stars" :style="{ width:widthInfo + 'rpx' }">
- <view class="stars-normal">
- <view class="box" :style="{ width:widthInfo + 'rpx' }">
- <block v-for="i_ in 5" :key="i_"><text class="iconfont" :class="iconClass" :style="{fontSize:fontSize+'rpx'}"></text></block>
- </view>
- </view>
- <view class="stars-selected" :style="{ width: (stars / 5) * 100 + '%',color:iconColor}">
- <view class="box" :style="{ width:widthInfo + 'rpx' }">
- <block v-for="j_ in 5" :key="j_"><text class="iconfont" :class="iconClass" :style="{fontSize:fontSize+'rpx'}"></text></block>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "Unistars",
- props: {
- stars: {
- // Unistars类型
- type: Number,
- default: 0
- },
- fontSize:{
- // fontSize类型
- type: Number,
- default: 30
- },
- widthInfo:{
- // fontSize类型
- type: Number,
- default: 146
- },
- iconClass:{
- // fontSize类型
- type: String,
- default:'icon-qian1'
- },
- iconColor:{
- // fontSize类型
- type: String,
- default:'#FFBD13'
- }
- },
- created() {
- },
- methods: {
-
- }
- };
- </script>
- <style scoped>
- .stars {
- height: 30upx;
- position: relative;
- float: left;
- }
- .stars-normal {
- width: 100%;
- position: absolute;
- left: 0;
- top: 0;
- color: #EAEAEA;
- }
- .stars-selected {
- position: absolute;
- left: 0;
- top: 0;
- z-index: 1;
- overflow: hidden;
- }
- </style>
|