视频教程:点击这里
认识
- 数字角标一般和其它控件(列表、9宫格、选项卡等)配合使用,用于进行数量提示。 角标的核心类是.mui-badge,默认为实心灰色背景;同时,mui还内置了蓝色(blue)、绿色(green)、黄色(yellow)、红色(red)、紫色(purple)五种色系的数字角标,如下:
- 代码结构
<span class="mui-badge">1</span>
<span class="mui-badge mui-badge-primary">12</span>
<span class="mui-badge mui-badge-success">123</span>
<span class="mui-badge mui-badge-warning">3</span>
<span class="mui-badge mui-badge-danger">45</span>
<span class="mui-badge mui-badge-purple">456</span>
注意:
- 若无需底色,则增加.mui-badge-inverted类即可,如下:
- 代码结构
<span class="mui-badge mui-badge-inverted">1</span>
<span class="mui-badge mui-badge-primary mui-badge-inverted">2</span>
<span class="mui-badge mui-badge-success mui-badge-inverted">3</span>
<span class="mui-badge mui-badge-warning mui-badge-inverted">4</span>
<span class="mui-badge mui-badge-danger mui-badge-inverted">5</span>
<span class="mui-badge mui-badge-royal mui-badge-inverted">6</span>
测试代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<script src="js/mui.min.js"></script>
<link href="css/mui.min.css" rel="stylesheet" />
<script type="text/javascript" charset="utf-8">
mui.init();
</script>
</head>
<!--
步骤:
1.按照格式<span class="mui-badge">1</span>写上标签,添加样式mui-badge
2.格局颜色的不同添加不同的class
3.若无需底色,则增加.mui-badge-inverted类即可,如下:
-->
<body>
<!-- 头部 -->
<header class="mui-bar mui-bar-nav">
<a class="mui-icon mui-icon-left-nav mui-action-back mui-pull-left"></a>
<h1 class="mui-title">数字角标(badge)</h1>
</header>
<!-- 内容 -->
<div class="mui-content">
<!-- 各种颜色样式的数字角标 -->
<span class="mui-badge">1</span>
<span class="mui-badge mui-badge-primary">12</span>
<span class="mui-badge mui-badge-success">123</span>
<span class="mui-badge mui-badge-warning">3</span>
<span class="mui-badge mui-badge-danger">45</span>
<span class="mui-badge mui-badge-purple">456</span>
<!-- mui-badge-inverted : 无底色,文字是使用的颜色 -->
<span class="mui-badge mui-badge-purple mui-badge-inverted">456</span>
</div>
</body>
</html>
效果
微信公众号:JavaWeb架构师视频教程:点击这里
源码下载
关注下方的微信公众号,回复:mui_course.code
网友评论