ant-design-vue/components/button/demo/loading.md

51 lines
1.1 KiB
Markdown
Raw Normal View History

2018-01-24 22:53:45 +08:00
<cn>
#### 加载中状态
添加 `loading` 属性即可让按钮处于加载状态,最后两个按钮演示点击后进入加载状态。
</cn>
<us>
#### Loading
A loading indicator can be added to a button by setting the `loading` property on the `Button`.
</us>
```html
2017-11-03 18:46:18 +08:00
<template>
<div>
2018-01-23 18:55:39 +08:00
<a-button type="primary" loading>
2017-11-03 18:46:18 +08:00
Loading
2018-01-23 18:55:39 +08:00
</a-button>
<a-button type="primary" size="small" loading>
2017-11-03 18:46:18 +08:00
Loading
2018-01-23 18:55:39 +08:00
</a-button>
2017-11-03 18:46:18 +08:00
<br />
2018-01-23 18:55:39 +08:00
<a-button type="primary" :loading="loading" @mouseenter="enterLoading">
2017-12-29 16:51:06 +08:00
mouseenter me!
2018-01-23 18:55:39 +08:00
</a-button>
<a-button type="primary" icon="poweroff" :loading="iconLoading" @click="enterIconLoading">
2017-12-29 16:51:06 +08:00
延迟1s
2018-01-23 18:55:39 +08:00
</a-button>
2017-11-03 18:46:18 +08:00
<br />
2018-01-23 18:55:39 +08:00
<a-button shape="circle" loading />
<a-button type="primary" shape="circle" loading />
2017-11-03 18:46:18 +08:00
</div>
</template>
<script>
export default {
data () {
return {
loading: false,
iconLoading: false,
}
},
methods: {
enterLoading () {
this.loading = true
},
enterIconLoading () {
2017-12-29 16:51:06 +08:00
this.iconLoading = { delay: 1000 }
2017-11-03 18:46:18 +08:00
},
},
}
</script>
2018-01-24 22:53:45 +08:00
```