starRating

功能描述

starRating是原生js星级评价组件,支持定制

依赖模块

快速使用

  1. starRating({
  2. starSize: 32,
  3. element: document.querySelector("#rater"),
  4. rateCallback: function(rating, done) {
  5. this.setRating(rating);
  6. done();
  7. }
  8. });

配置项

element

  • 类型:HTMLElement
  • 默认值:null
  • 作用:组件渲染元素
  • 是否必传:是

    starSize

  • 类型:Number

  • 默认值:16
  • 作用:组件渲染元素
  • 是否必传:否

    rateCallback

  • 类型:Function

  • 默认值:null
  • 作用:星值变化回调
  • 是否必传:否

特别说明

更多配置和用法,请参考examples