You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/04 08:24:40 UTC

[06/19] incubator-weex git commit: + [doc] update new feature documentation for image component

+ [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 <zh...@gmail.com>
Authored: Mon Oct 2 10:28:38 2017 +0800
Committer: gurisxie <27...@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