Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zui
提交
d8d5452a
Z
zui
项目概览
易企天创
/
zui
10 个月 前同步成功
通知
6
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
37
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
37
Issue
37
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d8d5452a
编写于
3月 04, 2019
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
+ add document file for load-indicator control.
上级
0059627b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
156 addition
and
0 deletion
+156
-0
docs/part/control-loading.md
docs/part/control-loading.md
+156
-0
未找到文件。
docs/part/control-loading.md
0 → 100644
浏览文件 @
d8d5452a
# 加载指示器
## 基本示例
使用辅助类
`.load-indicator`
和
`.loading`
即可显示一个加载指示器。
<div
class=
"example"
>
<div
class=
"load-indicator loading"
style=
"width: 100px; height: 100px; background: #eee"
></div>
</div>
```
html
<div
class=
"load-indicator loading"
style=
"width: 100px; height: 100px; background: #eee"
></div>
```
<div
class=
"alert alert-primary"
>
<h4>
注意
</h4>
<p>
加载指示器辅助类
<code>
.load-indicator
</code>
会自动应用
<code>
position: relative
</code>
样式,通常情况下没有问题,但是如果
<code>
.load-indicator
</code>
类所属的元素已将
<code>
position
</code>
设置为了
<code>
absolute
</code>
或
<code>
fixed
</code>
则需要重新覆盖
<code>
.load-indicator
</code>
的设置,否则可能导致界面样式不符合预期。
</p>
</div>
## 包含提示文本示例
使用
`[data-loading]`
属性来设置用于显示的提示文本。
<div
class=
"example"
>
<div
data-loading=
"正在加载..."
class=
"load-indicator loading"
style=
"width: 100px; height: 100px; background: #eee"
></div>
</div>
```
html
<div
data-loading=
"正在加载..."
class=
"load-indicator loading"
style=
"width: 100px; height: 100px; background: #eee"
></div>
```
## 使用 JS 控制
加载指示器仅提供 CSS 样式,如果需要动态控制,只需要使用 JS 在
`.load-indicator`
元素上添加
`.loading`
类即可显示正在加载状态,如果要移除正在加载状态的显示只需要使用 JS 移除
`.loading`
类。
<div
class=
"example"
>
<div
data-loading=
"正在加载..."
class=
"load-indicator"
style=
"width: 100px; height: 100px; background: #eee; margin-bottom: 10px"
id=
"loadIndicator1"
></div>
<button
type=
"button"
class=
"btn btn-primary"
id=
"loadIndicator1ToggleBtn"
>
显示/隐藏正在加载状态
</button>
</div>
```
html
<div
data-loading=
"正在加载..."
class=
"load-indicator"
style=
"width: 100px; height: 100px; background: #eee; margin-bottom: 10px"
id=
"loadIndicator1"
></div>
<button
type=
"button"
class=
"btn btn-primary"
id=
"loadIndicator1ToggleBtn"
>
显示/隐藏正在加载状态
</button>
```
```
js
$
(
'
#loadIndicator1ToggleBtn
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#loadIndicator1
'
).
toggleClass
(
'
loading
'
);
});
```
<script>
$(function() {
$('#loadIndicator1ToggleBtn').on('click', function() {
$('#loadIndicator1').toggleClass('loading');
});
});
</script>
## 修改图标
使用 CSS 来修改用于指示加载中的动画图标。
<div
class=
"example"
>
<div
id=
"loadIndicator3"
class=
"load-indicator loading"
style=
"width: 100px; height: 100px; background: #eee"
></div>
</div>
<style>
#loadIndicator3.load-indicator:after {content: '\e97b'}
</style>
```
html
<div
class=
"load-indicator loading"
style=
"width: 100px; height: 100px; background: #eee"
></div>
```
```
css
.load-indicator
:after
{
content
:
'\e97b'
}
```
## 与其他组件一起使用
加载指示器辅助类
`.load-indicator`
和
`.loading`
几乎可以与任何组件一起使用。
### 在按钮上使用
<div
class=
"example"
>
<button
type=
"button"
class=
"btn load-indicator loading"
>
按钮示例
</button>
</div>
```
html
<button
type=
"button"
class=
"btn load-indicator loading"
>
按钮示例
</button>
```
### 在面板中使用
<div
class=
"example"
>
<div
class=
"panel load-indicator loading"
data-loading=
"正在处理..."
>
<div
class=
"panel-heading"
contenteditable=
""
>
面板标题
</div>
<div
class=
"panel-body"
contenteditable=
""
>
面板内容
</div>
</div>
</div>
```
html
<div
class=
"panel load-indicator loading"
data-loading=
"正在处理..."
>
<div
class=
"panel-heading"
contenteditable=
""
>
面板标题
</div>
<div
class=
"panel-body"
contenteditable=
""
>
面板内容
</div>
</div>
```
### 在表单中使用
<div
class=
"example"
>
<form
class=
"form-horizontal load-indicator loading"
data-loading=
"正在提交,请稍后..."
>
<div
class=
"form-group"
>
<label
for=
"exampleInputAccount4"
class=
"col-sm-2"
>
账号
</label>
<div
class=
"col-md-6 col-sm-10"
>
<input
type=
"text"
class=
"form-control"
id=
"exampleInputAccount4"
placeholder=
"电子邮件/手机号/用户名"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"exampleInputPassword4"
class=
"col-sm-2"
>
密码
</label>
<div
class=
"col-md-6 col-sm-10"
>
<input
type=
"password"
class=
"form-control"
id=
"exampleInputPassword4"
placeholder=
"密码"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"exampleInputAddress1"
class=
"col-sm-2"
>
地址
</label>
<div
class=
"col-sm-3"
>
<select
class=
"form-control"
id=
"exampleInputAddress1"
>
<option>
北京
</option>
<option>
上海
</option>
</select>
</div>
<div
class=
"col-sm-3"
>
<input
type=
"text"
class=
"form-control"
id=
"exampleInputAddress2"
placeholder=
"市/县"
>
</div>
<div
class=
"col-sm-4"
>
<input
type=
"text"
class=
"form-control"
id=
"exampleInputAddress3"
placeholder=
"详细地址"
>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<div
class=
"checkbox"
>
<label>
<input
type=
"checkbox"
>
记住我
</label>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-default"
>
登录
</button>
</div>
</div>
</form>
</div>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录