layui-js/examples/rate.html

86 lines
1.5 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
//渲染
rate.render({
elem: '#test1',
length: 7,
value: 4
})
rate.render({
elem: '#test2',
length: 6,
value: 2,
half: true
})
rate.render({
elem: '#test3',
length: 5,
value: 3,
text: true
})
rate.render({
elem: '#test4',
length: 8,
value: 5,
reader: true
2018-04-24 17:57:31 +08:00
})
2018-04-24 10:21:01 +08:00
});
</script>
</body>
</html>