+ [doc] update new feature documentation for image component
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b2fa4be1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b2fa4be1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b2fa4be1 Branch: refs/heads/release-0.16 Commit: b2fa4be101a525550652c85b2e84a279311fe9d7 Parents: 933de5c Author: acton393 <zhangxing610...@gmail.com> Authored: Mon Oct 2 10:28:38 2017 +0800 Committer: gurisxie <279483...@qq.com> Committed: Wed Oct 4 16:21:38 2017 +0800 ---------------------------------------------------------------------- doc/source/cn/references/components/image.md | 24 +++++++++++++++++++++++ doc/source/references/components/image.md | 22 +++++++++++++++++++++ 2 files changed, 46 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b2fa4be1/doc/source/cn/references/components/image.md ---------------------------------------------------------------------- diff --git a/doc/source/cn/references/components/image.md b/doc/source/cn/references/components/image.md index bc675cb..c096a48 100644 --- a/doc/source/cn/references/components/image.md +++ b/doc/source/cn/references/components/image.md @@ -99,6 +99,30 @@ version: 2.1 æ¥ç [éç¨äºä»¶](../common-event.html) +## ç»ä»¶æ¹æ³ + <sup class="api-version">v0.16.0+</sup> + + - saveï¼ä¿åå½åå¾çå°æ¬å° + - åæ° + åè°å½æ°ä½ä¸ºæ¹æ³å ¥åï¼æ¥æ¶ä¿åç»æ. + ``` + var image = this.$refs.imageRef; // image æ¯ä¹åå·²ç»å®ä¹è¿çref + image.save(function(result) { + console.log(JSON.stringify(result)) + }); + ``` + - å¼æ¥è¿åçæ°æ®æè¿° + ``` + { +  "success" : true/false, // ä¿åæåæ失败 +  "errorDesc": "errordesc" // å¨success 为falseçæ åµä¼è¿å + } + ``` + - 说æ +Â å¯¹äº iOS ç³»ç»éè¦æ·»å `NSPhotoLibraryAddUsageDescription`ç¸å访é®æé, iOS 11 éè¦åæ·»å ä¸ä¸ª`NSPhotoLibraryAddUsageDescription`æé, [æ¥çæ´å¤iOSç³»ç»æé](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html) + + [è¯ä¸è¯](http://dotwe.org/vue/fadcd44a7031943ff0feaaf1895df414) + ## 约æ 1. éè¦æå®å®½é«ï¼ http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b2fa4be1/doc/source/references/components/image.md ---------------------------------------------------------------------- diff --git a/doc/source/references/components/image.md b/doc/source/references/components/image.md index cd8c59b..d0f2520 100644 --- a/doc/source/references/components/image.md +++ b/doc/source/references/components/image.md @@ -47,6 +47,28 @@ This component supports no child components. - `success` : `true` if the image was loaded successfully, otherwise `false` - `size` : the original size of image, contains two parameters: `naturalWidth` representing the original width of image in pixels, `naturalHeight` representing the original height of image in pixels. default value. The default value for both parameters is `0`. +**component method** + +- support save <sup class="api-version">v0.16.0+</sup> image to local device or photo album. + - you should specify a callback function to receive the saving result. + ``` + var image = this.$refs.imageRef; // image æ¯ä¹åå·²ç»å®ä¹è¿çref +  image.save(function(result) { +  console.log(JSON.stringify(result)) + }); + ``` + and the result can be the following format + ``` + { +  "success" : true/false, // ä¿åæåæ失败 +  "errorDesc": "errordesc" // å¨success 为falseçæ åµä¼è¿å + } + ``` + - note + you must add `NSPhotoLibraryAddUsageDescription` and `NSPhotoLibraryAddUsageDescription `(iOS 11) privacy to access photo album for iOS, [see more privacy](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html) + + [try it for saving image](http://dotwe.org/vue/fadcd44a7031943ff0feaaf1895df414) + ### Examples ```html