• Stars
    star
    181
  • Rank 205,343 (Top 5 %)
  • Language Vue
  • License
    MIT License
  • Created over 6 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⭐️ The smallest rating component for Vue2.x , use character★ and ☆ support mpvue

Vue Tiny Rate

npm

The Smallest Rating Component for Vuejs

based single-line rate component

function rate(num){
  return "★★★★★☆☆☆☆☆".slice(5 - num, 10 - num);
}
rate(3)   // "★★★☆☆"

Features

  • based ☆ and ★
  • support float such as 3.5 4.7
  • theme
  • animate
  • size

Translation

Installation and usage

Once, install rate component for your project

npm install vue-tiny-rate --save

Import Vue Rate into your app

import Rate from 'vue-tiny-rate';

new Vue({
    components: {
        Rate
    }
})

Use HTML template

<Rate />

Options from props

  • value {number|string} : Star value default:0
<Rate value="0.5"></Rate>
<Rate value="1"></Rate>
<Rate value="3.6"></Rate>

  • readonly {boolean} : Rate read-only. default:false
<Rate value="0.5"></Rate>
<Rate value="1"></Rate>
<Rate value="3.6" readonly="true"></Rate>

  • length {number|string} : Star size default:5
<Rate value="2" length="4"></Rate>
<Rate value="3.6" length="8"></Rate>
<Rate value="7.6" length="10"></Rate>

  • theme {color|enum('yellow','green','blue','red','purple','orange','black','wihte')}: Star color. default: yellow
<Rate value="4.5">Yellow</Rate>
<Rate value="4.5" theme="green">Green</Rate>
<Rate value="4.5" theme="blue">Blue</Rate>
<Rate value="4.5" theme="red">Red</Rate>
<Rate value="4.5" theme="purple">Purple</Rate>
<Rate value="4.5" theme="orange">Orange</Rate>
<Rate value="4.5" theme="black">Black</Rate>
<Rate value="4.5" theme="#91d5ff">#91d5ff</Rate>

  • size {number|string}: Rate size.
<Rate value="4.5" size='12px'>12px</Rate>
<Rate value="4.5" size='16px'>16px</Rate>
<Rate value="4.5" size='20px'>20px</Rate>
<Rate value="4.5" size='40px'>40px</Rate>

  • animate {number|string}: Rate animate duration. default:0
<Rate value="3.5" animate='1'>1s</Rate>
<Rate value="3.5" animate='2'>2s</Rate>
<Rate value="3.5" animate='3'>3s</Rate>

Events

  • onRate: Rate select callback.
<Rate @onRate="onrate" :value="value"/>
new Vue({
  el: '#app',
  components: { Rate },
  template: '<Rate @onRate="onrate" :value="value"/>',
  data: {
    value: '2.6'
  },
  methods: {
    onrate (num) {
      console.log(num)
      this.value = num
    }
  }
})

Link

License

MIT.

More Repositories

1

programmer-job-blacklist

🙈程序员找工作黑名单,换工作和当技术合伙人需谨慎啊 更新有赞
Shell
28,408
star
2

fe-advanced-interview

前端进阶面试指南
JavaScript
1,309
star
3

email-helper

Generate your business emails in seconds (by OpenAI)
TypeScript
743
star
4

it-roadmap

大圣的前端学习路线图
Python
527
star
5

vue3-vs-vue2

《前端会客厅第一期代码》和尤大聊vue3的 提升
HTML
410
star
6

self-employed-workbook

写给自己的程序员自由职业工作手册
394
star
7

woniu-cmdb

👻写配置文件生成增删改查系统
HTML
266
star
8

geektime-vue-course

极客时间代码
Vue
241
star
9

imooc-echarts

imooc的echarts入门教程
HTML
223
star
10

vue3-book

vue3源码分析3.0.0-beta.12 https://www.yuque.com/woniuppp/vue3
Vue
172
star
11

file-upload

面试造火箭系列
Vue
143
star
12

algorithm-camp

javascript算法训练营
JavaScript
141
star
13

footprint

🎎记录去过的足迹
HTML
136
star
14

iblockchain

Learn blockchain by building one in node.js
JavaScript
134
star
15

iconjs

:trollface: favico for fun
JavaScript
97
star
16

upload

文件上传思路
Vue
96
star
17

vue-master-lesson

Vue精英训练营
Vue
85
star
18

ailemente

vite+ts的组件库演示代码,element音译 ailemente
Vue
46
star
19

weiyouyi

JavaScript
44
star
20

benben

笨笨小助理(by OpenAI)
TypeScript
42
star
21

kkb-vue3

JavaScript
41
star
22

interview

我常问的一些面试题
41
star
23

understand-preact

preact+compat源码注释
JavaScript
34
star
24

hongbaoshu

红宝书精读训练营
HTML
30
star
25

professional-javascript-for-web-developer

红宝书第四版代码
JavaScript
30
star
26

js-algorithm

学习算法的js实现
JavaScript
27
star
27

tiny-rate

The Smallest Rating Component for fun
JavaScript
25
star
28

react-tiny-rate

⭐️ The smallest rating component for React , use character★ and ☆
JavaScript
22
star
29

react_bronze_to_king

React 从青铜到王者系列教程代码
JavaScript
17
star
30

shengxinjing.cn

个人博客
Vue
17
star
31

vue-master

vue学习代码
16
star
32

pytail

python实现tail -f功能,仅供学习
Python
16
star
33

douban_spider

豆瓣图书爬虫,根据isbn查信息
JavaScript
14
star
34

angular-lite

学习es6 webpack 手写angular造个轮子
JavaScript
13
star
35

reverse-print

反转打印的88W行代码JS实现
JavaScript
12
star
36

moyu

摸鱼
Python
12
star
37

shengxinjing

关于我
9
star
38

vue-action-next

vue实战课程代码
TypeScript
7
star
39

kkb-mp

小程序公开课代码
JavaScript
6
star
40

fullstack-challenges

前端挑战题解
5
star
41

awesome-pm

教产品经理和程序员撕逼教程
5
star
42

marrow-of-javascript

前端会客厅第二期代码-爱民老师
HTML
5
star
43

react-boss

react+node最佳实践的招聘应用
4
star
44

vue3-workshop

vue3训练营
4
star
45

saoleide

TypeScript
3
star
46

cuir

toy vue3 for education
3
star
47

f2eblog

写一点前端基础教程
JavaScript
3
star
48

zhihu_zhuanhan

知乎专栏文章收集工具
Python
2
star
49

static

static files
Shell
2
star
50

fis-postprocessor-annotate

在fis里继承ng-annotate的功能
JavaScript
2
star
51

jarvis

程序员个人助理小程序
2
star
52

learn-vue3-by-build-one

学习vue3
1
star
53

blogimgs

1
star
54

sandbox-vue

sandbox wapper for vue3
1
star
55

zhixing_top10

知行十大小程序
JavaScript
1
star
56

awesome-books

读书笔记,gitbook
1
star
57

pythonmyadmin

phpmyadmin的python简易版
1
star
58

vue3-static-table

JavaScript
1
star
59

scroll-demo

HTML
1
star
60

for-debug

1
star
61

funny-frontend

HTML
1
star
62

zhixing_spider

Python
1
star
63

react-dev-to-online

目录
1
star
64

books_to_read

狗哥和蘑菇想读的书
1
star