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/02 06:12:03 UTC
[1/2] incubator-weex git commit: + [doc] update new feature
documentation for image component
Repository: incubator-weex
Updated Branches:
refs/heads/master be52f693f -> cf4dcd96e
+ [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/master
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
[2/2] incubator-weex git commit: * [doc] update define ref to new
version for vue
Posted by gu...@apache.org.
* [doc] update define ref to new version for vue
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/cf4dcd96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/cf4dcd96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/cf4dcd96
Branch: refs/heads/master
Commit: cf4dcd96eab7fe366d15af2b4ff656beaf803d88
Parents: b5e1fdf
Author: acton393 <zh...@gmail.com>
Authored: Mon Oct 2 14:10:20 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Oct 2 14:10:20 2017 +0800
----------------------------------------------------------------------
doc/source/cn/references/advanced/extend-to-ios.md | 4 ++--
doc/source/references/advanced/extend-to-ios.md | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cf4dcd96/doc/source/cn/references/advanced/extend-to-ios.md
----------------------------------------------------------------------
diff --git a/doc/source/cn/references/advanced/extend-to-ios.md b/doc/source/cn/references/advanced/extend-to-ios.md
index bf949fd..3b3b54b 100644
--- a/doc/source/cn/references/advanced/extend-to-ios.md
+++ b/doc/source/cn/references/advanced/extend-to-ios.md
@@ -313,12 +313,12 @@ WeexSDK 0.9.5 之后支持了在 js 中直接调用 component 的方法,这里
```html
<template>
- <mycomponent id='mycomponent'></mycomponent>
+ <mycomponent ref='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created:function() {
- this.$el('mycomponent').focus();
+ this.$refs.mycomponent.focus();
}
}
</script>
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cf4dcd96/doc/source/references/advanced/extend-to-ios.md
----------------------------------------------------------------------
diff --git a/doc/source/references/advanced/extend-to-ios.md b/doc/source/references/advanced/extend-to-ios.md
index 9039754..02dc037 100644
--- a/doc/source/references/advanced/extend-to-ios.md
+++ b/doc/source/references/advanced/extend-to-ios.md
@@ -329,12 +329,12 @@ after your registration for your own custom component, now you can call it in yo
```html
<template>
- <mycomponent id='mycomponent'></mycomponent>
+ <mycomponent ref='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
- this.$el('mycomponent').focus();
+ this.$refs.mycomponent.focus();
}
}
</script>