Skip to content

Commit

Permalink
* [doc] Fix typo errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
yundongbot committed Feb 17, 2017
1 parent 6289eed commit a289793
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 145 deletions.
15 changes: 8 additions & 7 deletions doc/source/cn/references/advanced/extend-to-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,22 @@ public class ImageAdapter implements IWXImgLoaderAdapter {
```java
@JSMethod
public void focus(){
//method implementation
//method implementation
}
```

- 注册组之后,你可以在weex 文件中调用

```html
<template>
<mycomponent id='mycomponent'></mycomponent>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
</script>
```

Expand Down
75 changes: 38 additions & 37 deletions doc/source/cn/references/advanced/extend-to-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,43 +235,44 @@ return [[WXImageView alloc] init];
```

##### component 方法
WeexSDK 0.9.5 之后支持了在js中直接调用component的方法,这里提供一个例子,

WeexSDK 0.9.5 之后支持了在 js 中直接调用 component 的方法,这里提供一个例子

- 自定义一个WXMyCompoenent 的组件
- 自定义一个 WXMyCompoenent 的组件

```
@implementation WXMyComponent
WX_EXPORT_METHOD(@selector(focus)) // 暴露该方法给js
- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
{
if (self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance]) {
// handle your attributes
// handle your styles
}
return self;
}
- (void)focus
{
NSLog(@"you got it");
}
@end
```
```
@implementation WXMyComponent
WX_EXPORT_METHOD(@selector(focus)) // 暴露该方法给js
- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
{
if (self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance]) {
// handle your attributes
// handle your styles
}
return self;
}
- (void)focus
{
NSLog(@"you got it");
}
@end
```

- 注册组件 `[WXSDKEngine registerComponent:@"mycomponent" withClass:[WXMyComponent class]]`

- 在weex 文件中调用

```
<template>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created:function() {
this.$el('mycomponent').focus();
}
}
</script>
```
- 注册组件 `[WXSDKEngine registerComponent:@"mycomponent" withClass:[WXMyComponent class]]`

- 在 weex 文件中调用

```html
<template>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created:function() {
this.$el('mycomponent').focus();
}
}
</script>
```
14 changes: 7 additions & 7 deletions doc/source/cn/v-0.10/advanced/extend-to-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,21 @@ public class ImageAdapter implements IWXImgLoaderAdapter {
```java
@JSMethod
public void focus(){
//method implementation
//method implementation
}
```
- 注册组之后,你可以在weex 文件中调用

```html
<template>
<mycomponent id='mycomponent'></mycomponent>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
</script>
```

Expand Down
74 changes: 37 additions & 37 deletions doc/source/cn/v-0.10/advanced/extend-to-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,45 +234,45 @@ Weex SDK 只提供渲染,而不是其他的能力,如果你需要 像网络
<image style="your-custom-style" src="image-remote-source" resize="contain/cover/stretch"></image>
```
##### component 方法
WeexSDK 0.9.5 之后支持了在js中直接调用component的方法,这里提供一个例子,
- 自定义一个WXMyCompoenent 的组件
```
@implementation WXMyComponent
WX_EXPORT_METHOD(@selector(focus)) // 暴露该方法给js
- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
{
if (self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance]) {
// handle your attributes
// handle your styles
}
return self;
}
- (void)focus
{
NSLog(@"you got it");
}
@end
```
WeexSDK 0.9.5 之后支持了在js中直接调用component的方法,这里提供一个例子,

- 自定义一个WXMyCompoenent 的组件

```
@implementation WXMyComponent
WX_EXPORT_METHOD(@selector(focus)) // 暴露该方法给js
- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
{
if (self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance]) {
// handle your attributes
// handle your styles
}
return self;
}
- (void)focus
{
NSLog(@"you got it");
}
@end
```
- 注册组件 `[WXSDKEngine registerComponent:@"mycomponent" withClass:[WXMyComponent class]] `
- 在weex 文件中调用
- 注册组件 `[WXSDKEngine registerComponent:@"mycomponent" withClass:[WXMyComponent class]] `
- 在weex 文件中调用
```
<template>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
</script>
```
```html
<template>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
</script>
```



Expand Down
17 changes: 8 additions & 9 deletions doc/source/references/advanced/extend-to-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,23 @@ public class ImageAdapter implements IWXImgLoaderAdapter {
for example, define a method in component:

```java

@JSMethod
public void focus(){
//method implementation
//method implementation
}

```

after your registration for your own custom component, now you can call it in your js file.

```html
<template>
<mycomponent id='mycomponent'></mycomponent>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
</script>
```
14 changes: 7 additions & 7 deletions doc/source/references/advanced/extend-to-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ for example:

after your registration for your own custom component, now you can call it in your js file.

```
```html
<template>
<mycomponent id='mycomponent'></mycomponent>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
</script>
```
64 changes: 32 additions & 32 deletions doc/source/v-0.10/advanced/extend-to-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ public class MyViewComponent extends WXComponent{
public MyViewComponent(WXSDKInstance instance, WXDomObject dom,
WXVContainer parent, String instanceId, boolean isLazy)
{
public MyViewComponent(WXSDKInstance instance, WXDomObject dom,
WXVContainer parent, String instanceId, boolean isLazy) {
super(instance, dom, parent, instanceId, isLazy);
}

@Override
protected void initView() {
mHost = new TextView(mContext);
}
@WXComponentProp(name=WXDomPropConstant.WX_ATTR_VALUE)
public void setMyViewValue(String value) {
((TextView)mHost).setText(value);
}
public MyViewComponent(WXSDKInstance instance, WXDomObject dom,
WXVContainer parent, String instanceId, boolean isLazy) {
super(instance, dom, parent, instanceId, isLazy);
}

@Override
protected void initView() {
mHost = new TextView(mContext);
}
@WXComponentProp(name=WXDomPropConstant.WX_ATTR_VALUE)
public void setMyViewValue(String value) {
((TextView)mHost).setText(value);
}
}
```

Expand Down Expand Up @@ -160,30 +160,30 @@ public class ImageAdapter implements IWXImgLoaderAdapter {
}
}
```

#### Component Method
from WeexSDK `0.9.5`, you can define your component method
from WeexSDK `0.9.5`, you can define your component method

for example, define a method in component:

```java

@JSMethod
public void focus(){
//method implementation
}

```
after your registration for your own custom component, now you can call it in your js file.
for example, define a method in component:

```java
@JSMethod
public void focus(){
//method implementation
}
```

after your registration for your own custom component, now you can call it in your js file.

```html
```html
<template>
<mycomponent id='mycomponent'></mycomponent>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
</script>
```
18 changes: 9 additions & 9 deletions doc/source/v-0.10/advanced/extend-to-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,23 +281,23 @@ for example:
- (void)focus
{
NSLog(@"you got it");
NSLog(@"you got it");
}
@end
```

after your registration for your own custom component, now you can call it in your js file.
after your registration for your own custom component, now you can call it in your js file.

```
```html
<template>
<mycomponent id='mycomponent'></mycomponent>
<mycomponent id='mycomponent'></mycomponent>
</template>
<script>
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
module.exports = {
created: function() {
this.$el('mycomponent').focus();
}
}
</script>
```

Expand Down

0 comments on commit a289793

Please sign in to comment.