1.0.21 • Published 8 years ago

yu-rate v1.0.21

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

Introduce

rate plugin with star

Quick to start

Using npm:

$ npm install --save yu-rate
$ import rate from 'yu-rate'

Example

You can use npm run dev to check the example file in node package 1.render with text

   document.getElementById('target-dom').innerText = rate({type:'show-sim', num:3})

2.show star of rate

    rate({
            type:'show',
            num:1,
            all:5,
            color:'#2dbbed',
            target:document.querySelector('.example')
        });

3.build the rate for click

    rate({
            type:'rate',
            num:3,
            all:5,
            color:'yellow',
            target:document.querySelector('.example'),
            callback(){
                console.log('you clicked the rate')
            }
        })

4.auto render with class 'rate-auto' and 'data-*',can it be clicked depends on attribute 'disabled'

    <div class="rate-auto" data-all="6" data-num="1" disabled="disabled"></div>
    <div class="rate-auto" data-all="6" data-num="2""></div>

JSDoc

 * @param {object[]} option
 * @param {string} [option[].type] - type of rate,accept 'show-sim'(show rate with text,in this case other param should only be 'num') 'show'(show rate only,in this case other param shouldn't have 'callback') 'rate'(rate with click)
 * @param {string} [option[].all = 5] - all score
 * @param {number} [option[].num = 5] -  show how many score
 * @param {object} [option[].target] - target dom to render
 * @param {string} [option[].color] - set the color of star
 * @param {callback} [option[].callback] - the callback will be called when you chick the star of rate

Links

github npm

1.0.21

8 years ago

1.0.20

8 years ago

1.0.19

8 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago