layui-js/examples/rate.html
2018-04-26 00:03:58 +08:00

95 lines
1.6 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;
//渲染
var ins1 = rate.render({
elem: '#test1'
,length: 7
,value: 4
});
ins1.setvalue(2);
rate.render({
elem: '#test1'
,length: 7
,value: 4.2
})
rate.render({
elem: '#test2'
,length: 6
,value: 2
,half: true
})
rate.render({
elem: '#test3'
,length: 5
,value: 2.5
,text: true
,half: true
})
rate.render({
elem: '#test4'
,length: 8
,value: 4.7
,reader: true
})
});
</script>
</body>
</html>