增加 rate 组件

This commit is contained in:
star
2018-04-28 10:54:27 +08:00
parent c588a3a3b1
commit 6c5900d0f5
3 changed files with 66 additions and 29 deletions

View File

@@ -55,22 +55,34 @@ layui.use(['rate'], function(){
var rate = layui.rate;
//渲染
/*
rate.set({
elem: '#test1'
,length: 7
,value: 4.7
,theme: '#c00'
,half: true
,text: true
,reader: true
})
*/
// rate.set({
// elem: '#test1'
// ,length: 7
// ,value: 4.7
// ,theme: '#c00'
// ,half: true
// ,text: true
// ,reader: true
// })
rate.render({
elem: '#test1'
,length: 5
,length: 3
,value: 2.2
,text: true
,half: true
,setText: function(value){
var arrs = {
'0.5': '极差'
, '1' : '一般'
,'1.5': '满意'
,'2': '极满意'
};
this.span.text(arrs[value] || ( value + "星"));
}
})
rate.render({
@@ -79,15 +91,20 @@ layui.use(['rate'], function(){
,value: 2
,half: true
,theme: '#5FB878'
,choose: function(value){
if( value > 3) alert("111")
}
})
rate.render({
elem: '#test3'
,length: 5
,length: 3
,value: 2.8
,text: true
,half: true
,theme: '#FF5722'
})
rate.render({
elem: '#test4'
,length: 8