From ec213f87262dee72d949efb1a41466761aa1d082 Mon Sep 17 00:00:00 2001 From: star1029 <2321582517@qq.com> Date: Thu, 26 Apr 2018 00:03:58 +0800 Subject: [PATCH] test --- examples/rate.html | 13 ++++++------- src/lay/modules/rate.js | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/examples/rate.html b/examples/rate.html index 149b7f8..0ac38a9 100644 --- a/examples/rate.html +++ b/examples/rate.html @@ -55,13 +55,12 @@ layui.use(['rate'], function(){ var rate = layui.rate; //渲染 - // var ins1 = rate.render({ - // elem: '#test1' - // ,length: 7 - // ,value: 4 - // }); - // ins1.setValue(5); - + var ins1 = rate.render({ + elem: '#test1' + ,length: 7 + ,value: 4 + }); + ins1.setvalue(2); rate.render({ elem: '#test1' diff --git a/src/lay/modules/rate.js b/src/lay/modules/rate.js index 93f976d..07a61a2 100644 --- a/src/lay/modules/rate.js +++ b/src/lay/modules/rate.js @@ -28,11 +28,8 @@ layui.define('jquery',function(exports){ ,options = that.config; return { - - function(value){ - console.log(options) - - //that.setValue(); + setvalue: function(value){ + that.setvalue.call(that, value); } ,config: options } @@ -99,6 +96,16 @@ layui.define('jquery',function(exports){ }; + //重置value + Class.prototype.setvalue = function(value){ + var that = this + ,options = that.config ; + + options.value = value + + } + + //li触控事件 Class.prototype.action = function(){ var that = this