layui-js/examples/rate.html

102 lines
1.7 KiB
HTML
Raw Normal View History

2018-04-24 10:21:01 +08:00
<!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>
2018-04-24 14:56:49 +08:00
<div class="layui-container">
<div class="layui-row">
<!-- 基础评分用法 -->
2018-04-25 16:11:15 +08:00
<div class="layui-rate-div layui-col-xm4 layui-col-xm-offset4 ">
2018-04-24 14:56:49 +08:00
<h3>基础用法</h3>
<hr>
2018-04-25 16:11:15 +08:00
<div id="test1"></div>
2018-04-24 14:56:49 +08:00
</div>
2018-04-24 10:21:01 +08:00
2018-04-24 14:56:49 +08:00
<!-- 半星评分用法 -->
2018-04-25 16:11:15 +08:00
<div class="layui-rate-div layui-col-xm4 layui-col-xm-offset4 ">
2018-04-24 14:56:49 +08:00
<h3>选中半星</h3>
<hr>
2018-04-25 16:11:15 +08:00
<div id="test2"></div>
2018-04-24 14:56:49 +08:00
</div>
2018-04-24 10:21:01 +08:00
2018-04-24 14:56:49 +08:00
<!-- 显示提示文字 -->
2018-04-25 16:11:15 +08:00
<div class="layui-rate-div layui-col-xm4 layui-col-xm-offset4 ">
2018-04-24 14:56:49 +08:00
<h3>显示提示文字</h3>
<hr>
2018-04-25 16:11:15 +08:00
<div id="test3"></div>
2018-04-24 14:56:49 +08:00
<span></span>
</div>
<!-- 只读 -->
2018-04-25 16:11:15 +08:00
<div class="layui-rate-div layui-col-xm4 layui-col-xm-offset4 ">
2018-04-24 14:56:49 +08:00
<h3>只读</h3>
<hr>
2018-04-25 16:11:15 +08:00
<div id="test4"></div>
2018-04-24 14:56:49 +08:00
</div>
2018-04-24 17:57:31 +08:00
2018-04-24 14:56:49 +08:00
</div>
</div>
2018-04-24 10:21:01 +08:00
<script src="../src/layui.js"></script>
<script>
2018-04-24 14:56:49 +08:00
layui.use(['rate'], function(){
var rate = layui.rate;
2018-04-24 17:57:31 +08:00
2018-04-25 16:11:15 +08:00
//渲染
2018-04-26 14:00:57 +08:00
/*
rate.set({
2018-04-26 00:03:58 +08:00
elem: '#test1'
,length: 7
2018-04-26 14:00:57 +08:00
,value: 4.7
,theme: '#c00'
,half: true
,text: true
,reader: true
})
*/
2018-04-25 16:11:15 +08:00
rate.render({
2018-04-25 19:21:27 +08:00
elem: '#test1'
2018-04-26 14:00:57 +08:00
,length: 5
,value: 2.2
2018-04-25 16:11:15 +08:00
})
2018-04-25 19:21:27 +08:00
2018-04-25 16:11:15 +08:00
rate.render({
2018-04-25 19:21:27 +08:00
elem: '#test2'
,length: 6
,value: 2
,half: true
2018-04-26 14:00:57 +08:00
,theme: '#5FB878'
2018-04-25 16:11:15 +08:00
})
rate.render({
2018-04-25 19:21:27 +08:00
elem: '#test3'
,length: 5
2018-04-26 14:00:57 +08:00
,value: 2.8
2018-04-25 19:21:27 +08:00
,text: true
,half: true
2018-04-26 14:00:57 +08:00
,theme: '#FF5722'
2018-04-25 16:11:15 +08:00
})
rate.render({
2018-04-25 19:21:27 +08:00
elem: '#test4'
,length: 8
2018-04-26 14:00:57 +08:00
,value: 4.8
2018-04-25 19:21:27 +08:00
,reader: true
2018-04-26 14:00:57 +08:00
,theme: '#01AAED'
2018-04-24 17:57:31 +08:00
})
2018-04-24 10:21:01 +08:00
});
</script>
</body>
</html>