LoginSignup
1
0

More than 1 year has passed since last update.

Vue.js vue-star-ratingの導入方法

Posted at

背景

vue.jsにて星評価を実装する必要があり、備忘録として導入方法を残します。

環境

vue@2.6.12

導入方法

ターミナルにて以下コマンド実行

npm install vue-star-rating --save

router/index.jsに以下を記述

index.js
import StarRating from 'vue-star-rating'

Vue.use(StarRating);

Views側の記述方法 ※コンポーネントと同じ記述方法

views/xx.vue
<template>
<star-rating></star-rating>
</template>

<script>
import StarRating from "vue-star-rating"
export default{
  components:{
     StarRating
  }
}

以上です。

補足

星の値を取得したい場合は、
・v-model="rating"
・detaプロパディにrating :0

参考記事

(https://www.kabanoki.net/4632/)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0