From 9df9e24b63d2df7306198c9d7529fd7f7a333427 Mon Sep 17 00:00:00 2001 From: khtiana Date: Mon, 1 Nov 2021 10:09:17 +0800 Subject: [PATCH 1/3] support dynamic element --- api/phone/@internal/document.d.ts | 46 ++++++++++++++++++++++++++++++ api/phone/@internal/index.d.ts | 3 +- api/phone/@internal/viewmodel.d.ts | 21 ++++++++++++-- 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100755 api/phone/@internal/document.d.ts diff --git a/api/phone/@internal/document.d.ts b/api/phone/@internal/document.d.ts new file mode 100755 index 0000000000..b3766e0e1a --- /dev/null +++ b/api/phone/@internal/document.d.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020 Huawei Device 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. + */ + +export declare class document { + /** + * create Element. + * @param tagName is tagName. + */ + static createElement(tagName: string): DynamicElement; + +} + +export interface DynamicElement { + + /** + * setAttr to Element. + * @param eg{"src":"common/images/bg-tv.jpg"}. + */ + setAttr(attrParmas: object): void; + + /** + * setStyle to Element. + * @param eg{"width":"300px","height":"300px"} + */ + setStyle(styleParmas: object): void; + + /** + * append child to element(div) + * @param child element + */ + appendChildren(child: DynamicElement): void; + +} + diff --git a/api/phone/@internal/index.d.ts b/api/phone/@internal/index.d.ts index 8712a2be0c..2752a2a8c3 100755 --- a/api/phone/@internal/index.d.ts +++ b/api/phone/@internal/index.d.ts @@ -16,4 +16,5 @@ export * from './viewmodel'; export * from './featureability'; export * from './console'; -export * from './global'; \ No newline at end of file +export * from './global'; +export * from './document'; \ No newline at end of file diff --git a/api/phone/@internal/viewmodel.d.ts b/api/phone/@internal/viewmodel.d.ts index 190c9970a1..f78bf69818 100755 --- a/api/phone/@internal/viewmodel.d.ts +++ b/api/phone/@internal/viewmodel.d.ts @@ -461,6 +461,21 @@ export interface ButtonElement extends Element { setProgress(param: { progress: number }): void; } +/** + * The