欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

vue-star中怎么實(shí)現(xiàn)一個(gè)評(píng)星組件

vue-star中怎么實(shí)現(xiàn)一個(gè)評(píng)星組件,針對(duì)這個(gè)問題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡單易行的方法。

梁平網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,梁平網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為梁平上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的梁平做網(wǎng)站的公司定做!

star文件夾下建立Star.vue,及相關(guān)的圖片信息。便于組件的就近維護(hù)

vue-star中怎么實(shí)現(xiàn)一個(gè)評(píng)星組件

Star.vue:

<template>
 <div class="star" :class="starSize">
 <span v-for="(itemClass,key) in itemClasses" :class="itemClass" class="star-item"></span>
 </div>
</template>
<script>
 const LENGTH = 5;
 const CLS_ON = 'on';
 const CLS_HALF = 'half';
 const CLS_OFF = 'off';
 export default{
 props:{
  size:{ //尺寸,24,36,48
  type: Number
  },
  score:{
  type: Number
  }
 },
 computed:{
  starSize(){
  return 'star-'+ this.size;
  },
  itemClasses(){
  let result = [];
  let score = Math.floor(this.score*2)/2; //將數(shù)值調(diào)整為整數(shù)及.5的形式,例:4.3 => 4;4.6 => 4.5
  let hasDecimal = score %1 !==0;
  let integer = Math.floor(score);
  for(let i =0;i<integer;i++){
   result.push(CLS_ON);
  }
  if(hasDecimal){
   result.push(CLS_HALF);
  }
  while(result.length<LENGTH){
   result.push(CLS_OFF);
  }
  return result;
  }
 }
 }
</script>
<style lang="stylus" rel="stylesheet/stylus">
@import "../../common/stylus/mixin.styl";
.star
 font-size: 0
 .star-item
 display: inline-block
 background-repeat: no-repeat
 &.star-48
 .star-item
  width: 20px
  height: 20px
  margin-right: 22px
  background-size: 20px 20px
  &.last-child
  margin-right: 0
  &.on
  bg-image('star48_on')
  &.half
  bg-image('star48_half')
  &.off
  bg-image('star48_off')
 &.star-36
 .star-item
  width: 15px
  height: 15px
  margin-right: 6px
  background-size: 15px 15px
  &.last-child
  margin-right: 0
  &.on
  bg-image('star36_on')
  &.half
  bg-image('star36_half')
  &.off
  bg-image('star36_off')
 &.star-24
 .star-item
  width: 10px
  height: 10px
  margin-right: 3px
  background-size: 10px 10px
  &.last-child
  margin-right: 0
  &.on
  bg-image('star24_on')
  &.half
  bg-image('star24_half')
  &.off
  bg-image('star24_off')
</style>

Header.vue:

<star :size="48" :score="3.5"></star>
<script>
import star from '../star/Star.vue'
export default{
 components:{
 star
 }
}
</script>

mixin.styl:

bg-image($url)
 background-image: url($url + '@2x.png')
 @media (-webkit-min-device-pixel-ratio: 3),(min-device-pixel-ratio:3)
 background-image: url($url + '@3x.png')

關(guān)于vue-star中怎么實(shí)現(xiàn)一個(gè)評(píng)星組件問題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識(shí)。

本文標(biāo)題:vue-star中怎么實(shí)現(xiàn)一個(gè)評(píng)星組件
網(wǎng)址分享:http://aaarwkj.com/article34/jjggpe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信公眾號(hào)、微信小程序、App開發(fā)、標(biāo)簽優(yōu)化、搜索引擎優(yōu)化品牌網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)
西西美女掰开阴让你看| 九七青青草视频在线观看| 欧美日韩国产一下老妇| 国产av高清亚洲精品高清二部| 韩国av毛片在线播放| 免费毛片一区二区三区| 欧美日本国产老熟女视频| 久久精品国产亚洲av超一| 麻豆精品新av中文字幕| 婷婷六月亚洲中文字幕| 欧美夫妻成人性生活视频| 日日夜夜久久一二三区| 日韩人妻中文字幕亚洲| 亚洲二区三区四区在线| 人人妻人人澡人人妻| 婷婷激情综合亚洲五月色| 国产一区二区三区百合| 免费在线观看做性小视频| 日韩欧美一区二区狠狠插| 超碰欧美性欧美最猛性| 999久久久久亚洲精品| 久久久久亚洲av成人| 国产高清在线不卡一区| 午夜视频免费在线观看| 国产精品成人大片在线播放| 国产精品国产三级国产普通话99| 视频播放一区二区三区毛片| 日韩人妻精品中文字幕专区不卡| 午夜精品人妻一区二区| 欧美日韩一区二区综合性色| 日韩亚洲天堂视频免费观看| 亚洲五月综合激情综合久久| 日本av成人激情视频| 午夜福利成人在线免费观看| 在线观看男人的天堂av| 日本一区二区三区免费黄视频| 每日更新中文字幕粉嫩av| 欧美日韩精品在线二区| 视频一区二区视频三区| 日日干天天日夜夜操| 日韩人妻一区二区三区蜜桃视频密|