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/09 08:39:00 UTC
[19/50] 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/b5e1fdfd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b5e1fdfd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b5e1fdfd
Branch: refs/heads/release
Commit: b5e1fdfd0ab3824258153e6f2ecbbf1af61c78c1
Parents: be52f69
Author: acton393 <zh...@gmail.com>
Authored: Mon Oct 2 10:28:38 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Oct 2 13:59:34 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/b5e1fdfd/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/b5e1fdfd/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