未验证 提交 e77b94e2 编写于 作者: O openharmony_ci 提交者: Gitee

!15713 示例代码问题整改

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