diff --git a/components/avatar/demo/index.vue b/components/avatar/demo/index.vue
index 9cdfbb407..9c9ba2f30 100644
--- a/components/avatar/demo/index.vue
+++ b/components/avatar/demo/index.vue
@@ -14,23 +14,7 @@ const md = {
Avatars can be used to represent people or objects. It supports images, 'Icon's, or letters.
`,
}
-
-const UserList = ['U', 'Lucy', 'Tom', 'Edward']
-const colorList = ['#f56a00', '#7265e6', '#ffbf00', '#00a2ae']
export default {
- data () {
- return {
- avatarValue: UserList[0],
- color: colorList[0],
- }
- },
- methods: {
- changeValue () {
- const index = UserList.indexOf(this.avatarValue)
- this.avatarValue = index < UserList.length - 1 ? UserList[index + 1] : UserList[0]
- this.color = index < colorList.length - 1 ? colorList[index + 1] : colorList[0]
- },
- },
render () {
return (
diff --git a/components/index.js b/components/index.js
index 534188583..730e4d049 100644
--- a/components/index.js
+++ b/components/index.js
@@ -63,6 +63,8 @@ export { Collapse, CollapsePanel }
import notification from './notification'
import message from './message'
+export { default as Spin } from './spin'
+
const api = {
notification,
message,
diff --git a/components/spin/Spin.vue b/components/spin/Spin.vue
new file mode 100644
index 000000000..a911b710a
--- /dev/null
+++ b/components/spin/Spin.vue
@@ -0,0 +1,142 @@
+
diff --git a/components/spin/demo/basic.md b/components/spin/demo/basic.md
new file mode 100644
index 000000000..d29324538
--- /dev/null
+++ b/components/spin/demo/basic.md
@@ -0,0 +1,17 @@
+
+#### 基本用法
+一个简单的 loading 状态。
+
+
+
+#### basic Usage
+A simple loading status.
+
+
+```html
+
+
+
+```
diff --git a/components/spin/demo/custom-indicator.md b/components/spin/demo/custom-indicator.md
new file mode 100644
index 000000000..358bdd327
--- /dev/null
+++ b/components/spin/demo/custom-indicator.md
@@ -0,0 +1,19 @@
+
+#### 自定义指示符
+使用自定义指示符。
+
+
+
+#### Custom spinning indicator
+Use custom loading indicator.
+
+
+```html
+
+
+
+```
diff --git a/components/spin/demo/delayAndDebounce.md b/components/spin/demo/delayAndDebounce.md
new file mode 100644
index 000000000..fe86833da
--- /dev/null
+++ b/components/spin/demo/delayAndDebounce.md
@@ -0,0 +1,44 @@
+
+#### 延迟
+延迟显示 loading 效果。当 spinning 状态在 `delay` 时间内结束,则不显示 loading 状态。
+
+
+
+#### delay
+Specifies a delay for loading state. If `spinning` ends during delay, loading status won't appear.
+
+
+```html
+
+
+
+
+
+ 可以点击‘切换’按钮,延迟显示 loading 效果。当 spinning 状态在 `delay` 时间内结束,则不显示 loading 状态。
+
+
+
切换
+
+
+
+```
diff --git a/components/spin/demo/index.vue b/components/spin/demo/index.vue
new file mode 100644
index 000000000..914f76daf
--- /dev/null
+++ b/components/spin/demo/index.vue
@@ -0,0 +1,58 @@
+
diff --git a/components/spin/demo/inside.md b/components/spin/demo/inside.md
new file mode 100644
index 000000000..a24c60f9a
--- /dev/null
+++ b/components/spin/demo/inside.md
@@ -0,0 +1,27 @@
+
+#### 容器
+放入一个容器中。
+
+
+
+#### Inside a container
+Spin in a container.
+
+
+```html
+
+
+
+
+```
diff --git a/components/spin/demo/nested.md b/components/spin/demo/nested.md
new file mode 100644
index 000000000..39da31317
--- /dev/null
+++ b/components/spin/demo/nested.md
@@ -0,0 +1,43 @@
+
+#### 卡片加载中
+可以直接把内容内嵌到 `Spin` 中,将现有容器变为加载状态。
+
+
+
+#### Embedded mode
+Embedding content into `Spin` will alter it into loading state.
+
+
+```html
+
+
+
+
+
+ 可以点击‘切换’按钮,控制本区域的spin展示。
+
+
+
切换
+
+
+
+```
diff --git a/components/spin/demo/size.md b/components/spin/demo/size.md
new file mode 100644
index 000000000..c97ee4d64
--- /dev/null
+++ b/components/spin/demo/size.md
@@ -0,0 +1,19 @@
+
+#### 各种大小
+小的用于文本加载,默认用于卡片容器级加载,大的用于**页面级**加载。
+
+
+
+#### Size
+A small `Spin` use in loading text, default `Spin` use in loading card-level block, and large `Spin` use in loading **page**.
+
+
+```html
+
+
+
+```
diff --git a/components/spin/demo/tip.md b/components/spin/demo/tip.md
new file mode 100644
index 000000000..09402a1f4
--- /dev/null
+++ b/components/spin/demo/tip.md
@@ -0,0 +1,28 @@
+
+#### 自定义描述文案
+自定义描述文案。
+
+
+
+#### Customized description
+Customized description content.
+
+
+```html
+
+
+
+
+
+ 我的描述文案是自定义的。。。
+
+
+
+
+```
diff --git a/components/spin/index.en-US.md b/components/spin/index.en-US.md
new file mode 100644
index 000000000..c35607151
--- /dev/null
+++ b/components/spin/index.en-US.md
@@ -0,0 +1,11 @@
+
+## API
+
+| Property | Description | Type | Default Value |
+| -------- | ----------- | ---- | ------------- |
+| delay | specifies a delay in milliseconds for loading state (prevent flush) | number (milliseconds) | - |
+| indicator | React node of the spinning indicator | slot | - |
+| size | size of Spin, options: `small`, `default` and `large` | string | `default` |
+| spinning | whether Spin is spinning | boolean | true |
+| tip | customize description content when Spin has children | string | - |
+| wrapperClassName | className of wrapper when Spin has children | string | - |
diff --git a/components/spin/index.js b/components/spin/index.js
new file mode 100644
index 000000000..fd6f323e0
--- /dev/null
+++ b/components/spin/index.js
@@ -0,0 +1,3 @@
+import Spin from './Spin'
+
+export default Spin
diff --git a/components/spin/index.zh-CN.md b/components/spin/index.zh-CN.md
new file mode 100644
index 000000000..ed0ec4072
--- /dev/null
+++ b/components/spin/index.zh-CN.md
@@ -0,0 +1,11 @@
+
+## API
+
+| 参数 | 说明 | 类型 | 默认值 |
+| --- | --- | --- | --- |
+| delay | 延迟显示加载效果的时间(防止闪烁) | number (毫秒) | - |
+| indicator | 加载指示符 | slot方式 | - |
+| size | 组件大小,可选值为 `small` `default` `large` | string | 'default' |
+| spinning | 是否旋转 | boolean | true |
+| tip | 当作为包裹元素时,可以自定义描述文案 | string | - |
+| wrapperClassName | 包装器的类属性 | string | - |
diff --git a/components/spin/style/index.js b/components/spin/style/index.js
new file mode 100644
index 000000000..cf31ed80f
--- /dev/null
+++ b/components/spin/style/index.js
@@ -0,0 +1,2 @@
+import '../../style/index.less'
+import './index.less'
diff --git a/components/spin/style/index.less b/components/spin/style/index.less
new file mode 100644
index 000000000..d3e8f3481
--- /dev/null
+++ b/components/spin/style/index.less
@@ -0,0 +1,196 @@
+@import "../../style/themes/default";
+@import "../../style/mixins/index";
+
+@spin-prefix-cls: ~"@{ant-prefix}-spin";
+@spin-dot-default: @text-color-secondary;
+
+.@{spin-prefix-cls} {
+ .reset-component;
+ color: @primary-color;
+ vertical-align: middle;
+ text-align: center;
+ opacity: 0;
+ position: absolute;
+ transition: transform 0.3s @ease-in-out-circ;
+ display: none;
+
+ &-spinning {
+ opacity: 1;
+ position: static;
+ display: inline-block;
+ }
+
+ &-nested-loading {
+ position: relative;
+ > div > .@{spin-prefix-cls} {
+ position: absolute;
+ height: 100%;
+ max-height: 320px;
+ width: 100%;
+ z-index: 4;
+ .@{spin-prefix-cls}-dot {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin: -@spin-dot-size / 2;
+ }
+ .@{spin-prefix-cls}-text {
+ position: absolute;
+ top: 50%;
+ width: 100%;
+ padding-top: (@spin-dot-size - @font-size-base) / 2 + 2px;
+ text-shadow: 0 1px 2px #fff;
+ }
+ &.@{spin-prefix-cls}-show-text .@{spin-prefix-cls}-dot {
+ margin-top: -@spin-dot-size / 2 - 10px;
+ }
+ }
+
+ > div > .@{spin-prefix-cls}-sm {
+ .@{spin-prefix-cls}-dot {
+ margin: -@spin-dot-size-sm / 2;
+ }
+ .@{spin-prefix-cls}-text {
+ padding-top: (@spin-dot-size-sm - @font-size-base) / 2 + 2px;
+ }
+ &.@{spin-prefix-cls}-show-text .@{spin-prefix-cls}-dot {
+ margin-top: -@spin-dot-size-sm / 2 - 10px;
+ }
+ }
+
+ > div > .@{spin-prefix-cls}-lg {
+ .@{spin-prefix-cls}-dot {
+ margin: -@spin-dot-size-lg / 2;
+ }
+ .@{spin-prefix-cls}-text {
+ padding-top: (@spin-dot-size-lg - @font-size-base) / 2 + 2px;
+ }
+ &.@{spin-prefix-cls}-show-text .@{spin-prefix-cls}-dot {
+ margin-top: -@spin-dot-size-lg / 2 - 10px;
+ }
+ }
+ }
+
+ &-container {
+ position: relative;
+ .clearfix;
+ }
+
+ &-blur {
+ overflow: hidden;
+ opacity: 0.7;
+ -webkit-filter: blur(0.5px);
+ filter: blur(0.5px);
+
+ /* autoprefixer: off */
+ filter: ~"progid\:DXImageTransform\.Microsoft\.Blur(PixelRadius\=1, MakeShadow\=false)";
+ // workround for a strange style bug in safari:
+ // https://github.com/ant-design/ant-design/issues/4622
+ // have no clue why this works
+ -webkit-transform: translateZ(0);
+ &:after {
+ content: '';
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ background: #fff;
+ opacity: 0.3;
+ transition: all .3s;
+ z-index: 10;
+ }
+ }
+
+ // tip
+ // ------------------------------
+ &-tip {
+ color: @spin-dot-default;
+ }
+
+ // dots
+ // ------------------------------
+
+ &-dot {
+ position: relative;
+ display: inline-block;
+ .square(@spin-dot-size);
+ transform: rotate(45deg);
+ animation: antRotate 1.2s infinite linear;
+ i {
+ width: 9px;
+ height: 9px;
+ border-radius: 100%;
+ background-color: @primary-color;
+ transform: scale(0.75);
+ display: block;
+ position: absolute;
+ opacity: 0.3;
+ animation: antSpinMove 1s infinite linear alternate;
+ transform-origin: 50% 50%;
+ &:nth-child(1) {
+ left: 0;
+ top: 0;
+ }
+ &:nth-child(2) {
+ right: 0;
+ top: 0;
+ animation-delay: 0.4s;
+ }
+ &:nth-child(3) {
+ right: 0;
+ bottom: 0;
+ animation-delay: 0.8s;
+ }
+ &:nth-child(4) {
+ left: 0;
+ bottom: 0;
+ animation-delay: 1.2s;
+ }
+ }
+ }
+
+ // Sizes
+ // ------------------------------
+ // small
+ &-sm &-dot {
+ .square(@spin-dot-size-sm);
+ i {
+ width: 6px;
+ height: 6px;
+ }
+ }
+
+ // large
+ &-lg &-dot {
+ .square(@spin-dot-size-lg);
+ i {
+ width: 14px;
+ height: 14px;
+ }
+ }
+
+ &&-show-text &-text {
+ display: block;
+ }
+}
+
+@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
+ /* IE10+ */
+ .@{spin-prefix-cls}-blur {
+ background: @component-background;
+ opacity: 0.5;
+ }
+}
+
+@keyframes antSpinMove {
+ to {
+ opacity: 1;
+ }
+}
+
+@keyframes antRotate {
+ to {
+ transform: rotate(405deg);
+ }
+}
diff --git a/components/style.js b/components/style.js
index fc3973e1d..04b06522b 100644
--- a/components/style.js
+++ b/components/style.js
@@ -20,3 +20,4 @@ import './card/style'
import './collapse/style'
import './notification/style'
import './message/style'
+import './spin/style'
diff --git a/examples/demo.js b/examples/demo.js
index 0e8d60654..27dfc1427 100644
--- a/examples/demo.js
+++ b/examples/demo.js
@@ -21,4 +21,5 @@ export { default as divider } from 'antd/divider/demo/index.vue'
export { default as collapse } from 'antd/collapse/demo/index.vue'
export { default as notification } from 'antd/notification/demo/index.vue'
export { default as message } from 'antd/message/demo/index.vue'
+export { default as spin } from 'antd/spin/demo/index.vue'
diff --git a/examples/routes.js b/examples/routes.js
index 5e4a0d694..74145911d 100644
--- a/examples/routes.js
+++ b/examples/routes.js
@@ -3,7 +3,7 @@ const AsyncComp = () => {
const hashs = window.location.hash.split('/')
const d = hashs[hashs.length - 1]
return {
- component: import(`../components/vc-select/demo/${d}.vue`),
+ component: import(`../components/spin/demo/index.vue`),
}
}
export default [