[WEEX-86][doc] Update loading component's document.

Project: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-weex-site/commit/53d37f00
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/53d37f00
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/53d37f00

Branch: refs/heads/master
Commit: 53d37f00c6a7bb8b45076e30faaffd30b7a9df27
Parents: 27c2ab2
Author: miomin <[email protected]>
Authored: Thu Jan 18 14:53:41 2018 +0800
Committer: miomin <[email protected]>
Committed: Thu Jan 18 14:53:41 2018 +0800

----------------------------------------------------------------------
 source/cn/references/components/loading.md | 174 ++++++++++--------------
 source/references/components/loading.md    | 106 +++++++++++++++
 2 files changed, 181 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/53d37f00/source/cn/references/components/loading.md
----------------------------------------------------------------------
diff --git a/source/cn/references/components/loading.md 
b/source/cn/references/components/loading.md
index 08db367..085b603 100644
--- a/source/cn/references/components/loading.md
+++ b/source/cn/references/components/loading.md
@@ -2,127 +2,103 @@
 title: <loading>
 type: references
 group: 内置组件
-order: 8.08
+order: 8.09
 version: 2.1
 ---
 
 # &lt;loading&gt;
 
-<span class="weex-version">v0.6.1+</span>
+### <span class="weex-version">v0.6.1+</span>
 
-`<loading>` 为 `<scroller>` 和 `<list>` 提供上拉加
载功能。用法与特性与 `<refresh>` 类似, 是 `<scroller>` 和 
`<list>` 的子组件,且只能在被 `<scroller>` 和 `<list>` 包
含时才能被正确的渲染。
+`<loading>` 为容器提供上拉加载功能,用法和属性与 `<refresh>` 
类似。
+> **注意:**`<loading>` 是 
`<scroller>`、`<list>`、`<hlist>`、`<vlist>`、`<waterfall>` 
的子组件,只能在被它们包含时才能被正确渲染。
+
+ - 简单示例:
+
+```
+<list>
+  ...
+  ...
+  <loading>
+    ...
+  </loading>
+</list>
+```
+ - 查看 [完整示例](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)
 
 ## 子组件
 
-- [`<text>`](./text.html)
-- [`<image>`](./image.html)
-- `<loading-indicator>`: `<refresh>` 和 `<loading>` 
组件的子组件,拥有默认的动画效果的实现。
+ - 诸如 `<text>`、`<image>` 之类的任何组件,都可以放到 
`<loading>` 进行渲染。
 
-## 特性
+ - 特殊子组件 `<loading-indicator>`: 只能作为 `<refresh>` 和 
`<loading>` 的子组件使用,拥有默认的动画效果实现。
 
-- `display {string}`:可选值为 `show` 或者 `hide`,仅隐藏 
`<indicator>`,`<loading>` 其他子组件依然可见,`loading` 
事件仍会被触发。
+ - 简单示例:
 
-## 样式
+```
+<loading>
+  <text>Loading</text>
+  <loading-indicator></loading-indicator>
+  ...
+</loading>
+```
+ - 查看 [完整示例](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)
 
-支持所有通用样式。
+## 属性
 
-- 盒模型
-- `flexbox` 布局
-- `position`
-- `opacity`
-- `background-color`
+| 属性名           | 类型     | 值                          | 默认值  
   |
+| ------------- | ------ | -------------------------- | ------- |
+| `display` | String | show / hide             | show      |
 
-查看 [组件通用样式](../common-style.html)
+### `display`
 
-## 事件
+ - `show`:如果 `<loading>` 中包含 `<loading-indicator>`,则将å…
¶æ˜¾ç¤ºå¹¶å¼€å§‹é»˜è®¤åŠ¨ç”»ã€‚
 
-- `loading`:加载时被触发。
+ - `hide`:收起 loading view,如果 `<loading>` 中包含 
`<loading-indicator>`,则将其视图隐藏。
 
-## 约束
+> **注意:** `display` 的设置必须成对出现,即设置 
`display="show"`,必须有对应的 `display="hide"`。
 
-- `<loading>` 不支持 `remove`,v0.9 版本会修复。
-- `display` 值为 `show` 或 `hide`。仅隐藏 `<indicator>`,`<loading>` å…
¶ä»–子组件依然可见,`loading` 事件仍会被触发。
+ - 简单示例:
 
-  如果需要 `<loading>` hide 
时隐藏文案并不再触发事件,有两种解决方法:
+ ```
+ <template>
+   <list>
+     ...
+     ...
+     <loading @loading="onloading" :display="loadinging ? 'show' : 'hide'">
+       ...
+     </loading>
+     ...
+   </list>
+ </template>
 
-  1. 修改提示文案,并在 `loading` 事件中添加判断逻辑;
-  2. v0.9+ 可通过 `remove` 解决。
+ <script>
+   ...
+   methods: {
+     onloading (event) {
+       this.loadinging = true
+       setTimeout(() => {
+         this.loadinging = false
+       }, 2000)
+     },
+   }
+ </script>
+ ```
+ - 查看 [完整示例](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)
 
-- 只能通过 `display` 特性进行展示和隐藏,且必
须成对出现,即设置 `display="show"`,必须有对应的 
`display="hide"`。
+ - 支持所有通用属性。查看 [组件通用属性](../common-attrs.html)
 
-## 示例
+## 样式
 
-```html
-<template>
-  <scroller class="scroller">
-    <div class="cell" v-for="num in lists">
-      <div class="panel">
-        <text class="text">{{num}}</text>
-      </div>
-    </div>
-    <loading class="loading" @loading="onloading" :display="showLoading">
-      <text class="indicator">Loading ...</text>
-    </loading>
-  </scroller>
-</template>
-
-<script>
-  const modal = weex.requireModule('modal')
-  const LOADMORE_COUNT = 4
-
-  export default {
-    data () {
-      return {
-        showLoading: 'hide',
-        lists: [1, 2, 3, 4, 5]
-      }
-    },
-    methods: {
-      onloading (event) {
-        modal.toast({ message: 'loading', duration: 1 })
-        this.showLoading = 'show'
-        setTimeout(() => {
-          const length = this.lists.length
-          for (let i = length; i < length + LOADMORE_COUNT; ++i) {
-            this.lists.push(i + 1)
-          }
-          this.showLoading = 'hide'
-        }, 1500)
-      }
-    }
-  }
-</script>
-
-<style scoped>
-  .panel {
-    width: 600px;
-    height: 250px;
-    margin-left: 75px;
-    margin-top: 35px;
-    margin-bottom: 35px;
-    flex-direction: column;
-    justify-content: center;
-    border-width: 2px;
-    border-style: solid;
-    border-color: #DDDDDD;
-    background-color: #F5F5F5;
-  }
-  .text {
-    font-size: 50px;
-    text-align: center;
-    color: #41B883;
-  }
-  .loading {
-    justify-content: center;
-  }
-  .indicator {
-    color: #888888;
-    font-size: 42px;
-    padding-top: 20px;
-    padding-bottom: 20px;
-    text-align: center;
-  }
-</style>
-```
+ - 支持所有通用样式。查看 [组件通用样式](../common-style.html)
+
+## 事件
+
+### `loading`
+
+ - 当 `<scroller>`、`<list>`、`<hlist>`、`<vlist>`、`<waterfall>` 
被上拉时触发。
+
+ - 查看 [完整示例](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)
+
+## 示例
 
-[Try it](http://dotwe.org/vue/d5c1b2336a703a6e6e47c303af41ffcd)
+ - [完整示例](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)

http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/53d37f00/source/references/components/loading.md
----------------------------------------------------------------------
diff --git a/source/references/components/loading.md 
b/source/references/components/loading.md
new file mode 100644
index 0000000..fc4389e
--- /dev/null
+++ b/source/references/components/loading.md
@@ -0,0 +1,106 @@
+---
+title: <loading>
+type: references
+group: Build-in Components
+order: 8.09
+version: 2.1
+---
+
+# &lt;loading&gt;
+
+### <span class="weex-version">v0.6.1+</span>
+
+The `<loading>` Component provide a pullup to loading function for some 
special containers, its usage and attributes are similar to the `<refresh>` 
Component.
+> **Note:** To be rendered properly, the `<loading>` Component must appear 
inside the special Component such as 
`<scroller>`、`<list>`、`<hlist>`、`<vlist>`、`<waterfall>`.
+
+ - Example:
+
+```
+<list>
+  ...
+  ...
+  <loading>
+    ...
+  </loading>
+</list>
+```
+
+ - Complete example goes 
[here](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)
+
+## Child Components
+
+ - Any other components, like the `<text>` and `<image>` components, can be 
put inside the loading component.
+
+ - `<loading-indicator>`: This is a dedicated component which provides a 
default loading animation effect, can only be used inside the `<refresh>` or 
the `<loading>` components.
+
+ - Example:
+
+```
+<loading>
+  <text>Loading</text>
+  <loading-indicator></loading-indicator>
+  ...
+</loading>
+```
+ - Complete example goes 
[here](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)
+
+## Attributes
+
+ - Support all common attributes, check out [common 
attributes](../common/common-attrs)
+
+| Attribute      | Type     | Value            | Default Value     |
+| ------------- | ------ | -------------------------- | ------- |
+| `display` | String | show / hide             | show      |
+
+#### `display`
+
+ - `show`:The loading animation will be started if a `<loading-indicator>` 
is included in the loading component.
+
+ - `hide`:Collapse the loading view. It also hides the `<loading-indicator>` 
and stops the loading animation if there's a `<loading-indicator>` included in 
the loading component.
+
+> **Note:** The visibility of `<loading>` component can be controlled by 
display attribute with the value show and hide. A `display="show"` should 
always be paired with a `display="hide"` statement.
+
+ - Example:
+
+```
+<template>
+  <list>
+    ...
+    ...
+    <loading @loading="onloading" :display="loadinging ? 'show' : 'hide'">
+      ...
+    </loading>
+    ...
+  </list>
+</template>
+
+<script>
+  ...
+  methods: {
+    onloading (event) {
+      this.loadinging = true
+      setTimeout(() => {
+        this.loadinging = false
+      }, 2000)
+    },
+  }
+</script>
+```
+ - Complete example goes 
[here](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)
+
+## Styles
+
+ - Please check out the [common styles](../common/common-style)
+
+## Events
+
+### `onloading`
+
+ - Triggered when the scroller or list is pulled up.
+
+ - Complete example goes 
[here](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)
+
+
+## Example
+
+ - Complete example goes 
[here](http://dotwe.org/vue/d1f0283206f66fec6549f7896e6c6164)

Reply via email to