103 lines
3.0 KiB
HTML
103 lines
3.0 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 layui-col-xm4 layui-col-xm-offset4 ">
|
|
<h3>基础用法</h3>
|
|
<hr>
|
|
<ul class="layui-rate-primary">
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- 半星评分用法 -->
|
|
<div class="layui-rate layui-col-xm4 layui-col-xm-offset4 ">
|
|
<h3>选中半星</h3>
|
|
<hr>
|
|
<ul class="layui-rate-half">
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- 显示提示文字 -->
|
|
<div class="layui-rate layui-col-xm4 layui-col-xm-offset4 ">
|
|
<h3>显示提示文字</h3>
|
|
<hr>
|
|
<ul class="layui-rate-text">
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
</ul>
|
|
<span></span>
|
|
</div>
|
|
|
|
<!-- 只读 -->
|
|
<div class="layui-rate layui-col-xm4 layui-col-xm-offset4 ">
|
|
<h3>只读</h3>
|
|
<hr>
|
|
<ul class="layui-rate-read">
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate-solid"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate-solid"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="test1"></div>
|
|
<div id="test2"></div>
|
|
<div id="test3"></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script src="../src/layui.js"></script>
|
|
<script>
|
|
|
|
layui.use(['rate'], function(){
|
|
var rate = layui.rate;
|
|
|
|
//设置全局
|
|
rate.set({
|
|
score: 3.5
|
|
});
|
|
|
|
|
|
var ins = rate.render({
|
|
elem: '#test1'
|
|
})
|
|
|
|
|
|
rate.primary(".layui-rate-primary","li");
|
|
rate.half(".layui-rate-half","li");
|
|
rate.text(".layui-rate-text","li");
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|