提交 f0878957 编写于 作者: Y yamila

ArkUI uniformity

Signed-off-by: Nyamila <tianyu55@huawei.com>
上级 8df1ac0c
...@@ -596,7 +596,7 @@ export default { ...@@ -596,7 +596,7 @@ export default {
// 在detail页面中 // 在detail页面中
export default { export default {
onInit() { onInit() {
console.info('showData1:' + router.getParams()[data1]); console.info('showData1:' + router.getParams()['data1']);
} }
} }
``` ```
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
自定义组件是用户根据业务需求,将已有的组件组合,封装成的新组件,可以在工程中多次调用,从而提高代码的可读性。自定义组件通过element引入到宿主页面,使用方法如下: 自定义组件是用户根据业务需求,将已有的组件组合,封装成的新组件,可以在工程中多次调用,从而提高代码的可读性。自定义组件通过element引入到宿主页面,使用方法如下:
```html ```html
<element name='comp' src='../../common/component/comp.hml'></element> <element name='comp' src='../common/component/comp.hml'></element>
<div> <div>
<comp prop1='xxxx' @child1="bindParentVmMethod"></comp> <comp prop1='xxxx' @child1="bindParentVmMethod"></comp>
</div> </div>
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
结合if-else使用自定义组件的示例,showComp1为true时显示自定义组件comp1,否则显示comp2: 结合if-else使用自定义组件的示例,showComp1为true时显示自定义组件comp1,否则显示comp2:
```html ```html
<element name='comp1' src='../../common/component/comp1/comp1.hml'></element> <element name='comp1' src='../common/component/comp1/comp1.hml'></element>
<element name='comp2' src='../../common/component/comp2/comp2.hml'></element> <element name='comp2' src='../common/component/comp2/comp2.hml'></element>
<div> <div>
<comp1 if="{{showComp1}}" prop1='xxxx' @child1="bindParentVmMethodOne"></comp1> <comp1 if="{{showComp1}}" prop1='xxxx' @child1="bindParentVmMethodOne"></comp1>
<comp2 else prop1='xxxx' @child1="bindParentVmMethodTwo"></comp2> <comp2 else prop1='xxxx' @child1="bindParentVmMethodTwo"></comp2>
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<element name='comp' src='../../common/component/comp.hml'></element> <element name='comp' src='../common/component/comp.hml'></element>
<div class="container"> <div class="container">
<comp @event-type1="textClicked"></comp> <comp @event-type1="textClicked"></comp>
</div> </div>
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<element name='comp' src='../../common/comp/comp.hml'></element> <element name='comp' src='../common/comp/comp.hml'></element>
<div class="container"> <div class="container">
<text>父组件:{{text}}</text> <text>父组件:{{text}}</text>
<comp @event-type1="textClicked"></comp> <comp @event-type1="textClicked"></comp>
......
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<element name='comp' src='../../common/component/comp/comp.hml'></element> <element name='comp' src='../common/component/comp/comp.hml'></element>
<div class="container"> <div class="container">
<comp comp-prop="{{title}}"></comp> <comp comp-prop="{{title}}"></comp>
</div> </div>
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<element name='comp' src='../../common/component/comp/comp.hml'></element> <element name='comp' src='../common/component/comp/comp.hml'></element>
<div class="container"> <div class="container">
<comp title="自定义组件"></comp> <comp title="自定义组件"></comp>
</div> </div>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
引用该自定义组件方式如下: 引用该自定义组件方式如下:
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<element name='comp' src='../../common/component/comp.hml'></element> <element name='comp' src='../common/component/comp.hml'></element>
<div class="container"> <div class="container">
<comp> <comp>
<text class="text-style">父组件中定义的内容</text> <text class="text-style">父组件中定义的内容</text>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
引用该自定义组件方式如下: 引用该自定义组件方式如下:
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<element name='comp' src='../../common/component/comp.hml'></element> <element name='comp' src='../common/component/comp.hml'></element>
<div class="container"> <div class="container">
<comp> <comp>
<text class="text-style" slot="second">插入第二个插槽中</text> <text class="text-style" slot="second">插入第二个插槽中</text>
......
...@@ -108,7 +108,7 @@ struct CardExample { ...@@ -108,7 +108,7 @@ struct CardExample {
.visibility(Visibility.Visible) .visibility(Visibility.Visible)
.onAcquired((form)=>{ .onAcquired((form)=>{
console.log(`form info : ${JSON.stringify(form)}`); console.log(`form info : ${JSON.stringify(form)}`);
this.fomId = form.id; this.formId = form.id;
}) })
.onError((err)=>{ .onError((err)=>{
console.log(`fail to add form, err: ${JSON.stringify(err)}`); console.log(`fail to add form, err: ${JSON.stringify(err)}`);
......
...@@ -359,20 +359,16 @@ struct ImageExample3 { ...@@ -359,20 +359,16 @@ struct ImageExample3 {
### 渲染沙箱路径图片 ### 渲染沙箱路径图片
```ts ```ts
import fileio from '@ohos.fileio' import fileio from '@ohos.fileio';
import fs from '@ohos.file.fs' import fs from '@ohos.file.fs';
import context from '@ohos.application.context' import context from '@ohos.app.ability.common';
@Entry @Entry
@Component @Component
struct LoadImageExample { struct LoadImageExample {
@State resourcesPath: string = '' @State resourcesPath: string = ''
@State sandboxPath: string = '' @State sandboxPath: string = ''
context: context.AbilityContext context: context.UIAbility = getContext(this) as context.UIAbilityContext
aboutToAppear() {
this.context = getContext(this) as context.AbilityContext
}
build() { build() {
Column() { Column() {
......
...@@ -46,7 +46,7 @@ PluginComponent(value: { template: PluginComponentTemplate, data: KVObject}) ...@@ -46,7 +46,7 @@ PluginComponent(value: { template: PluginComponentTemplate, data: KVObject})
```ts ```ts
//PluginUserExample.ets //PluginUserExample.ets
import plugin from "plugin_component.js" import plugin from "./plugin_component.js"
@Entry @Entry
@Component @Component
...@@ -102,7 +102,7 @@ struct PluginUserExample { ...@@ -102,7 +102,7 @@ struct PluginUserExample {
```ts ```ts
//PluginProviderExample.ets //PluginProviderExample.ets
import plugin from "plugin_component.js" import plugin from "./plugin_component.js"
@Entry @Entry
@Component @Component
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册