vue-star-rate
Version:
a vue star rating component for mobile
43 lines (42 loc) • 976 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>star-rating</title>
<script src="../node_modules/vue/dist/vue.js"></script>
<script src="../dist/star-rating.js"></script>
</head>
<body>
<div id="app">
<span>myRating</span>
<star-rating
@rate="showScore"
:color="color"
:score="score"
></star-rating>
<span>{{ score }}</span>
</div>
<script>
new Vue({
el: '#app',
components: {
starRating: starRating.default,
},
data() {
return {
color: 'blue',
score: 1,
};
},
methods: {
showScore(val) {
console.log(val);
this.score = val;
},
},
});
</script>
</body>
</html>