Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-star-rate

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-star-rate

a vue star rating component for mobile

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

A Vue2.x Star Rating Component for mobile

a simple star rating component for morden mobile browsers

USAGE

Install

    npm i vue-star-rate

QuickStart

  • for vue >= 2.2.0
<template>
  <div>
    <span>MyRatings</span>
    <star-rating
      :size="size"
      :color="color"
      :maxScore="maxScore"
      :readOnly="readOnly"
      v-model="score"
    ></star-rating>
    <span>{{score}}</span>
  </div>
</template>

<script>
import starRating from "vue-star-rate";
export default {
  name: "HelloWorld",
  components: {
    starRating
  },
  data() {
    return {
      score: 3.5,
      color:'#f00',
      size:1,
      maxScore:5,
      readOnly:false
    };
  }
}
</script>
  • for vue < 2.2.0
<template>
  <div>
    <span>MyRatings</span>
    <star-rating
      :size= 'size'
      :color= 'color'
      :score= 'score'
      :maxScore= 'maxScore'
      :readOnly= 'readOnly'
      @rate='rate'
    ></star-rating>
    <span>{{score}}</span>
  </div>
</template>

<script>
import starRating from "vue-star-rate";
export default {
  name: "HelloWorld",
  components: {
    starRating
  },
  data() {
    return {
      score: 3.5,
      color:'#f00',
      size:1,
      maxScore:5,
      readOnly:false
    };
  },
  methods: {
    rate(val) {
      this.score = val;
    }
  }
}
</script>

Docs

  • Attribute
AttributeDescriptionTypeDefault
scoreThe initial ratingNumber0
maxScoreThe max scoreNumber5
sizeThe fontSize of star, you should use rem unitNumber1
colorThe color of starString#f7ba2a
readOnlywhether Rate is read-onlyBooleanfalse
v-modelbinding value(vue>2.2.0)Number-
  • Event
Event NameDescriptionParameters
rateTriggers when you click the star to ratevalue of your rating

LICENSE

MIT

Keywords

FAQs

Package last updated on 18 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc