layui-js/examples/rate.html
2018-04-26 14:00:57 +08:00

102 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>评分 - layui</title>
<link rel="stylesheet" href="../src/css/layui.css">
<style>
body{padding:20px;}
</style>
</head>
<body>
<div class="layui-container">
<div class="layui-row">
<!-- 基础评分用法 -->
<div class="layui-rate-div layui-col-xm4 layui-col-xm-offset4 ">
<h3>基础用法</h3>
<hr>
<div id="test1"></div>
</div>
<!-- 半星评分用法 -->
<div class="layui-rate-div layui-col-xm4 layui-col-xm-offset4 ">
<h3>选中半星</h3>
<hr>
<div id="test2"></div>
</div>
<!-- 显示提示文字 -->
<div class="layui-rate-div layui-col-xm4 layui-col-xm-offset4 ">
<h3>显示提示文字</h3>
<hr>
<div id="test3"></div>
<span></span>
</div>
<!-- 只读 -->
<div class="layui-rate-div layui-col-xm4 layui-col-xm-offset4 ">
<h3>只读</h3>
<hr>
<div id="test4"></div>
</div>
</div>
</div>
<script src="../src/layui.js"></script>
<script>
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.render({
elem: '#test1'
,length: 5
,value: 2.2
})
rate.render({
elem: '#test2'
,length: 6
,value: 2
,half: true
,theme: '#5FB878'
})
rate.render({
elem: '#test3'
,length: 5
,value: 2.8
,text: true
,half: true
,theme: '#FF5722'
})
rate.render({
elem: '#test4'
,length: 8
,value: 4.8
,reader: true
,theme: '#01AAED'
})
});
</script>
</body>
</html>