diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets index 6a97a6fb48d2fd1961f1b88bee8ebc0e5f2bde06..aad3c88d5f177af57db81cac083cb9ddd05e209c 100644 --- a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import plugin from "plugin_component.js" +import plugin from "../common/plugin_component.js" @Entry @Component diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1310d6f783df35ccad68be0204f2764013ac9d6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import plugin from "../common/plugin_component.js" + +@Entry +@Component +struct PluginUserExample { + @StorageLink("plugincount") plugincount: Object[] = [ + { source: 'plugincomponent1', ability: 'com.example.plugin' }, + { source: 'plugintemplate', ability: 'com.example.myapplication' }, + { source: 'plugintemplate', ability: 'com.example.myapplication' }] + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button('Register Request Listener') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.onListener() + console.log("Button('Register Request Listener')") + }) + Button('Request') + .fontSize(50) + .width(400) + .height(100) + .margin({ top: 20 }) + .onClick(() => { + plugin.Request() + console.log("Button('Request')") + }) + ForEach(this.plugincount, item => { + PluginComponent({ + template: { source: 'plugincomponent1', ability: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } + }).size({ width: 500, height: 100 }) + .onComplete(() => { + console.log("onComplete") + }) + .onError(({errcode, msg}) => { + console.log("onComplete" + errcode + ":" + msg) + }) + }) + } + .width('100%') + .height('100%') + } +} +