starRating

功能描述

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

依赖模块

快速使用

starRating({
    starSize: 32,
    element: document.querySelector("#rater"),
    rateCallback: function(rating, done) {
        this.setRating(rating);
        done();
    }
});

配置项

element

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

    starSize

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

    rateCallback

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

特别说明

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