[WEEX-86][doc] Update stream 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/1342cddf Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/1342cddf Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/1342cddf Branch: refs/heads/master Commit: 1342cddfb827a2c46fdce34fac1ac31569118d71 Parents: 40b5aaf Author: miomin <[email protected]> Authored: Thu Jan 18 16:28:53 2018 +0800 Committer: miomin <[email protected]> Committed: Thu Jan 18 16:28:53 2018 +0800 ---------------------------------------------------------------------- source/cn/references/modules/stream.md | 73 ++--------------------------- source/references/modules/stream.md | 70 +-------------------------- 2 files changed, 4 insertions(+), 139 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/1342cddf/source/cn/references/modules/stream.md ---------------------------------------------------------------------- diff --git a/source/cn/references/modules/stream.md b/source/cn/references/modules/stream.md index fd83124..bae42f7 100644 --- a/source/cn/references/modules/stream.md +++ b/source/cn/references/modules/stream.md @@ -37,6 +37,7 @@ version: 2.1 - `statusText {string}`ï¼ç¶ææè¿°ææ¬ - `data {Object | string}`: è¿åçæ°æ®ï¼å¦æè¯·æ±ç±»åæ¯ `json` å `jsonp`ï¼åå®å°±æ¯ä¸ä¸ª object ï¼å¦æä¸æ¯ï¼åå®å°±æ¯ä¸ä¸ª stringã - `headers {Object}`ï¼ååºå¤´ + - `progressCallback {Function}`ï¼å ³äºè¯·æ±ç¶æçåè°ã è¿ä¸ªåè°å½æ°å°å¨è¯·æ±å®æå就被è°ç¨: - `readyState {number}`ï¼å½åç¶æ state:'1': 请æ±è¿æ¥ä¸ @@ -50,76 +51,8 @@ version: 2.1 ### 注æ - é»è®¤ Content-Type æ¯ 'application/x-www-form-urlencoded'ã - - å¦æä½ éè¦éè¿ `POST` json ï¼ ä½ éè¦å° Content-Type 设为 'application/json'ã + - å¦æä½ éè¦éè¿ `POST` json ï¼ éè¦å° Content-Type 设为 'application/json'ã ### Example -```html -<template> - <div class="wrapper"> - <div class="group"> - <text class="title">Weex Star :</text> - <text class="count">{{weexStar}}</text> - </div> - <div class="group"> - <text class="title">Vue Star :</text> - <text class="count">{{vueStar}}</text> - </div> - </div> -</template> - -<script> - var stream = weex.requireModule('stream') - export default { - data () { - return { - weexStar: 'unknown', - vueStar: 'unknown' - } - }, - - methods: { - getStarCount (repo, callback) { - return stream.fetch({ - method: 'GET', - type: 'json', - url: 'https://api.github.com/repos/' + repo - }, callback) - } - }, - created () { - this.getStarCount('alibaba/weex', res => { - this.weexStar = res.ok ? res.data.stargazers_count : '(network error)' - }) - this.getStarCount('vuejs/vue', res => { - this.vueStar = res.ok ? res.data.stargazers_count : '(network error)' - }) - } - } -</script> - - -<style scoped> - .wrapper { - flex-direction: column; - justify-content: center; - } - .group { - flex-direction: row; - justify-content: center; - margin-bottom: 40px; - } - .title { - font-size: 45px; - color: #888888; - } - .count { - font-size: 45px; - font-weight: bold; - margin-left: 12px; - color: #41B883; - } -</style> -``` - -[try it](http://dotwe.org/vue/29bbf2d49fc8a204f98240044bbe211a) +[stream demo](http://dotwe.org/vue/e182a9fbbeb6f0763cd1df1baddf1e10) http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/1342cddf/source/references/modules/stream.md ---------------------------------------------------------------------- diff --git a/source/references/modules/stream.md b/source/references/modules/stream.md index ee56d22..0f8ccda 100644 --- a/source/references/modules/stream.md +++ b/source/references/modules/stream.md @@ -61,72 +61,4 @@ Start a network request, use two callbacks to receive server's response data. ### Example -```html -<template> - <div class="wrapper"> - <div class="group"> - <text class="title">Weex Star :</text> - <text class="count">{{weexStar}}</text> - </div> - <div class="group"> - <text class="title">Vue Star :</text> - <text class="count">{{vueStar}}</text> - </div> - </div> -</template> - -<script> - var stream = weex.requireModule('stream') - export default { - data () { - return { - weexStar: 'unknown', - vueStar: 'unknown' - } - }, - - methods: { - getStarCount (repo, callback) { - return stream.fetch({ - method: 'GET', - type: 'json', - url: 'https://api.github.com/repos/' + repo - }, callback) - } - }, - created () { - this.getStarCount('alibaba/weex', res => { - this.weexStar = res.ok ? res.data.stargazers_count : '(network error)' - }) - this.getStarCount('vuejs/vue', res => { - this.vueStar = res.ok ? res.data.stargazers_count : '(network error)' - }) - } - } -</script> - - -<style scoped> - .wrapper { - flex-direction: column; - justify-content: center; - } - .group { - flex-direction: row; - justify-content: center; - margin-bottom: 40px; - } - .title { - font-size: 45px; - color: #888888; - } - .count { - font-size: 45px; - font-weight: bold; - margin-left: 12px; - color: #41B883; - } -</style> -``` - -[try it](http://dotwe.org/vue/29bbf2d49fc8a204f98240044bbe211a) +[stream demo](http://dotwe.org/vue/e182a9fbbeb6f0763cd1df1baddf1e10)
