mirror of
https://gitee.com/layui/layui.git
synced 2025-10-27 03:09:32 +08:00
增加 rate 组件
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user