[WEEX-86][doc] Update modal 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/40b5aaf6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/40b5aaf6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/40b5aaf6

Branch: refs/heads/master
Commit: 40b5aaf631c6248af1b2b6f7f62dc445bb9cdb8d
Parents: aaf57d5
Author: miomin <[email protected]>
Authored: Thu Jan 18 15:48:15 2018 +0800
Committer: miomin <[email protected]>
Committed: Thu Jan 18 15:48:15 2018 +0800

----------------------------------------------------------------------
 source/cn/references/modules/modal.md | 129 +++++++++++------------------
 source/references/modules/modal.md    | 123 +++++++++++----------------
 2 files changed, 97 insertions(+), 155 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/40b5aaf6/source/cn/references/modules/modal.md
----------------------------------------------------------------------
diff --git a/source/cn/references/modules/modal.md 
b/source/cn/references/modules/modal.md
index 175748d..2ffe7a5 100644
--- a/source/cn/references/modules/modal.md
+++ b/source/cn/references/modules/modal.md
@@ -22,7 +22,17 @@ version: 2.1
   - `message {string}`:展示的内容
   - `duration {number}`:展示的持续时间(以秒为单位)
     - Android: 
如果时间长度大于3s,将使用一个被称为**LONG**的系统变量, 
否则使用**SHORT**这个系统变量
-    - iOS: 持续的时间同Duration相同。
+    - iOS: 持续的时间同Duration相同
+
+#### 基本用法
+```
+var modal = weex.requireModule('modal')
+modal.toast({
+    message: 'This is a toast',
+    duration: 0.3
+})
+```
+
 
 ### `alert(options, callback)`
 
@@ -35,6 +45,19 @@ version: 2.1
   - `okTitle 
{string}`:确定按钮上显示的文字信息,默认是“OK”
   - `callback {Function}`:用户操作完成后的回调
 
+#### 基本用法
+```
+var modal = weex.requireModule('modal')
+modal.alert({
+    message: 'This is a alert',
+    duration: 0.3
+}, function (value) {
+    console.log('alert callback', value)
+})
+```
+
+
+
 ### `confirm(options, callback)`
 
 确认框用于使用户可以验证或者
接受某些信息。当确认框出现后,用户需要点击确定或者
取消按钮才能继续进行操作。
@@ -47,6 +70,18 @@ version: 2.1
   - `cancelTitle {string}`:取消按钮上显示的文字信息,默认是 
`Cancel`
 - `callback {function 
(result)}`:用户操作完成后的回调,回调函数的参数 `result` 
是确定按钮上的文字信息字符串
 
+#### 基本用法
+```
+var modal = weex.requireModule('modal')
+modal.confirm({
+    message: 'Do you confirm ?',
+    duration: 0.3
+}, function (value) {
+    console.log('confirm callback', value)
+})
+```
+
+
 ### `prompt(options, callback)`
 
 提示框经常用于提示用户在进入页面前输å…
¥æŸä¸ªå€¼ã€‚当提示框出现后,用户需要输å…
¥æŸä¸ªå€¼ï¼Œç„¶åŽç‚¹å‡»ç¡®è®¤æˆ–取消按钮才能继续操作。
@@ -57,86 +92,22 @@ version: 2.1
   - `message {string}`:提示框内要显示的文字信息
   - `okTitle {string}`:确认按钮上显示的文字信息,默认是 `OK`
   - `cancelTitle {string}`:取消按钮上显示的文字信息,默认是 
`Cancel`
-- `callback {function 
(ret)}`:用户操作完成后的回调,回调函数的参数 `ret` æ 
¼å¼å½¢å¦‚ `{ result: 'OK', data: 'hello world' }`,如下
+- `callback {function 
(ret)}`:用户操作完成后的回调,回调函数的参数 `ret` æ 
¼å¼å½¢å¦‚ `{ result: 'OK', data: 'hello world' }`,如下:
   - `result {string}`:用户按下的按钮上的文字信息
   - `data {string}`:用户输入的文字信息
 
-
-## Example
-
-```html
-<template>
-  <div class="wrapper">
-    <text class="button" @click="showToast">Toast</text>
-    <text class="button" @click="showAlert">Alert</text>
-    <text class="button" @click="showConfirm">Confirm</text>
-    <text class="button" @click="showPrompt">Prompt</text>
-  </div>
-</template>
-
-<script>
-  var modal = weex.requireModule('modal')
-
-  export default {
-    methods: {
-      showToast (event) {
-        console.log('will show toast')
-        modal.toast({
-          message: 'This is a toast',
-          duration: 0.3
-        })
-      },
-      showAlert (event) {
-        console.log('will show alert')
-        modal.alert({
-          message: 'This is a alert',
-          duration: 0.3
-        }, function (value) {
-          console.log('alert callback', value)
-        })
-      },
-      showConfirm (event) {
-        console.log('will show confirm')
-        modal.confirm({
-          message: 'Do you confirm ?',
-          duration: 0.3
-        }, function (value) {
-          console.log('confirm callback', value)
-        })
-      },
-      showPrompt (event) {
-        console.log('will show prompt')
-        modal.prompt({
-          message: 'This is a prompt',
-          duration: 0.3
-        }, function (value) {
-          console.log('prompt callback', value)
-        })
-      }
-    }
-  };
-</script>
-
-<style scoped>
-  .wrapper {
-    flex-direction: column;
-    justify-content: center;
-  }
-  .button {
-    font-size: 60px;
-    width: 450px;
-    text-align: center;
-    margin-top: 30px;
-    margin-left: 150px;
-    padding-top: 20px;
-    padding-bottom: 20px;
-    border-width: 2px;
-    border-style: solid;
-    color: #666666;
-    border-color: #DDDDDD;
-    background-color: #F5F5F5
-  }
-</style>
+#### 基本用法
+```
+var modal = weex.requireModule('modal')
+modal.prompt({
+    message: 'This is a prompt',
+    duration: 0.3
+}, function (value) {
+    console.log('prompt callback', value)
+})
 ```
 
-[try it](http://dotwe.org/vue/a7dddfb24edb72be947fc4eec3803f1d)
+
+## 示例
+
+[Modal demo](http://dotwe.org/vue/a7dddfb24edb72be947fc4eec3803f1d)

http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/40b5aaf6/source/references/modules/modal.md
----------------------------------------------------------------------
diff --git a/source/references/modules/modal.md 
b/source/references/modules/modal.md
index 04d89a3..4005769 100644
--- a/source/references/modules/modal.md
+++ b/source/references/modules/modal.md
@@ -22,6 +22,16 @@ A toast provides simple feedback about an operation in a 
small popup. For exampl
    - For Android: If the duration is longer than 3, it will use a system 
defined variable called **LONG**, otherwise it will use another variable called 
**SHORT**
    - For iOS: It will show the toast during the specified time.
 
+#### Basic Usage
+```
+var modal = weex.requireModule('modal')
+modal.toast({
+    message: 'This is a toast',
+    duration: 0.3
+})
+```
+
+
 ### alert(options, callback)
 
 An alert box is often used if you want to make sure information comes through 
to the user.
@@ -36,6 +46,18 @@ When an alert box pops up, the user will have to click "OK" 
to proceed.
   This method has a callback function whose arguments will be:
 - `result` (string): the title text of the confirm button that clicked by user.
 
+#### Basic Usage
+```
+var modal = weex.requireModule('modal')
+modal.alert({
+    message: 'This is a alert',
+    duration: 0.3
+}, function (value) {
+    console.log('alert callback', value)
+})
+```
+
+
 ### confirm(options, callback)
 A confirm box is often used if you want the user to verify or accept something.
 
@@ -51,6 +73,18 @@ When a confirm box pops up, the user will have to click 
either confirm or cancel
 This method has a callback function whose arguments will be:
 - `result`(string): the title text of the button that clicked by user.
 
+#### Basic Usage
+```
+var modal = weex.requireModule('modal')
+modal.confirm({
+    message: 'Do you confirm ?',
+    duration: 0.3
+}, function (value) {
+    console.log('confirm callback', value)
+})
+```
+
+
 ### prompt(options, callback)
 
 A prompt box is often used if you want the user to input a value before 
entering a page.
@@ -67,81 +101,18 @@ When a prompt box pops up, the user will have to click 
either confirm or cancel
   - `result` (string): the title of the button that clicked by user.
   - `data` (string): the value of the text that entered by user.
 
-## Example
-
-```html
-<template>
-  <div class="wrapper">
-    <text class="button" @click="showToast">Toast</text>
-    <text class="button" @click="showAlert">Alert</text>
-    <text class="button" @click="showConfirm">Confirm</text>
-    <text class="button" @click="showPrompt">Prompt</text>
-  </div>
-</template>
-
-<script>
-  var modal = weex.requireModule('modal')
-
-  export default {
-    methods: {
-      showToast (event) {
-        console.log('will show toast')
-        modal.toast({
-          message: 'This is a toast',
-          duration: 0.3
-        })
-      },
-      showAlert (event) {
-        console.log('will show alert')
-        modal.alert({
-          message: 'This is a alert',
-          duration: 0.3
-        }, function (value) {
-          console.log('alert callback', value)
-        })
-      },
-      showConfirm (event) {
-        console.log('will show confirm')
-        modal.confirm({
-          message: 'Do you confirm ?',
-          duration: 0.3
-        }, function (value) {
-          console.log('confirm callback', value)
-        })
-      },
-      showPrompt (event) {
-        console.log('will show prompt')
-        modal.prompt({
-          message: 'This is a prompt',
-          duration: 0.3
-        }, function (value) {
-          console.log('prompt callback', value)
-        })
-      }
-    }
-  };
-</script>
-
-<style scoped>
-  .wrapper {
-    flex-direction: column;
-    justify-content: center;
-  }
-  .button {
-    font-size: 60px;
-    width: 450px;
-    text-align: center;
-    margin-top: 30px;
-    margin-left: 150px;
-    padding-top: 20px;
-    padding-bottom: 20px;
-    border-width: 2px;
-    border-style: solid;
-    color: #666666;
-    border-color: #DDDDDD;
-    background-color: #F5F5F5
-  }
-</style>
+#### Basic Usage
 ```
+var modal = weex.requireModule('modal')
+modal.prompt({
+    message: 'This is a prompt',
+    duration: 0.3
+}, function (value) {
+    console.log('prompt callback', value)
+})
+```
+
+
+## Example
 
-[try it](http://dotwe.org/vue/a7dddfb24edb72be947fc4eec3803f1d)
+[Modal demo](http://dotwe.org/vue/a7dddfb24edb72be947fc4eec3803f1d)

Reply via email to