This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<star-rating :rating="7"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="star-rating"> | |
<font-awesome-icon | |
class="star" | |
icon="star" | |
v-for="fs in fullStars" | |
:key="`fs${fs}`" | |
/> | |
<font-awesome-layers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<font-awesome-layers | |
class="star" | |
v-for="hs in halfStars" | |
:key="`hs${hs}`" | |
> | |
<font-awesome-icon icon="star-half"/> | |
<font-awesome-icon | |
flip="horizontal" | |
:icon="['far', 'star-half']" | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<h2>These are my children:</h2> | |
<ul> | |
<slot></slot> | |
</ul> | |
</div> | |
</template> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="star-rating"> | |
<font-awesome-icon | |
class="star" | |
icon="star" | |
v-for="fs in fullStars" | |
:key="`fs${fs}`" | |
/> | |
<font-awesome-layers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="star-rating"> | |
<font-awesome-icon | |
class="star" | |
icon="star" | |
v-for="(fs, i) in fullStars" | |
:key="`fs${i}`" | |
/> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
export default { | |
// ... | |
computed: { | |
fullStars () { | |
let { rating, starRatio } = this | |
return Math.floor(rating / starRatio) | |
}, | |
halfStars () { | |
let { rating, starRatio } = this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<img src="./assets/logo.png"> | |
<star-rating/> | |
</div> | |
</template> | |
<script> | |
import StarRating from './components/StarRating' | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="star-rating"> | |
<font-awesome-icon class="star" icon="star"/> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { | |
FontAwesomeIcon, | |
FontAwesomeLayers | |
} from '@fortawesome/vue-fontawesome' | |
export default { | |
name: "StarRating", | |
components: { | |
FontAwesomeIcon, |