nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clockin/src/main/ets/utils/Constants.ets
arkts
Copyright (c) 2024 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, soft...
export class Constants { static readonly COLUMN_SPACE: number = 8; // column内容间距 static readonly TRIANGLE_WIDTH: number = 10; // 信息窗口三角宽度 static readonly TRIANGLE_HEIGHT: number = 8; // 信息窗口三角高度 static readonly DEFAULT_ANIMATION_DURATION: number = 100; // 默认动画时长 static readonly DEFAULT_LOCATION_TIME_INTERVAL:...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly COLUMN_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#prope...
export class Constants { static readonly COLUMN_SPACE: number = 8; static readonly TRIANGLE_WIDTH: number = 10; static readonly TRIANGLE_HEIGHT: number = 8; static readonly DEFAULT_ANIMATION_DURATION: number = 100; static readonly DEFAULT_LOCATION_TIME_INTERVAL: number = 3; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clockin/src/main/ets/utils/Constants.ets#L16-L22
c16cec404f5d3b1513f1e82c1b664b75bfe77341
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/theme/AppTypography.ets
arkts
应用字体样式规范
export class AppTypography { // 字号 static readonly fontSizeXSmall: number = 10; static readonly fontSizeSmall: number = 12; static readonly fontSizeMedium: number = 14; static readonly fontSizeLarge: number = 16; static readonly fontSizeXLarge: number = 18; static readonly fontSizeXXLarge: number = 20; ...
AST#export_declaration#Left export AST#class_declaration#Left class AppTypography AST#class_body#Left { // 字号 AST#property_declaration#Left static readonly fontSizeXSmall : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Righ...
export class AppTypography { static readonly fontSizeXSmall: number = 10; static readonly fontSizeSmall: number = 12; static readonly fontSizeMedium: number = 14; static readonly fontSizeLarge: number = 16; static readonly fontSizeXLarge: number = 18; static readonly fontSizeXXLarge: number = 20; stati...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/theme/AppTypography.ets#L4-L26
50801795f8f7a9f1b6849b1ade7bfb66f80db6e1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets
arkts
off
TODO:知识点:解绑
off(): void { this.inputController.off("insertText"); this.inputController.off("deleteLeft"); this.isListen = false; logger.info("detached"); // 退出文本编辑状态 this.inputController.hideTextInput(); this.isKeyboardShow = false; }
AST#method_declaration#Left off AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#...
off(): void { this.inputController.off("insertText"); this.inputController.off("deleteLeft"); this.isListen = false; logger.info("detached"); this.inputController.hideTextInput(); this.isKeyboardShow = false; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets#L104-L112
8c35e495dd83d8201c7feda34fbef6ce2589b52e
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/model/Message.ets
arkts
聊天消息列表中的每个聊天消息数据的封装对象(本对像仅用于各聊天界面中ListView的UI显示时,不会用作别的地方)。
export default class Message { /** 消息发送者的id("我"发出的消息,则此id就是本地用户的uid) */ senderId: string = '' ; /** 消息发送者的昵称(用于显示) */ senderDisplayName: string = ''; /** 消息时间戳 */ date: number = 0; /** 消息内容(注意:此消息内容可能并非扁平文本,可能是对象的JSON字串,以不同消息定义的封装对象为准)。*/ content: string = ''; /** 消息类型 */ msgType: number = MsgType...
AST#export_declaration#Left export default AST#class_declaration#Left class Message AST#class_body#Left { /** 消息发送者的id("我"发出的消息,则此id就是本地用户的uid) */ AST#property_declaration#Left senderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#...
export default class Message { senderId: string = '' ; senderDisplayName: string = ''; date: number = 0; content: string = ''; msgType: number = MsgType.TYPE_TEXT; fingerPrintOfProtocal: string = ''; fingerPrintOfParent: string = ''; sendStatus: MsgSendStatus = MsgSendStatus.s...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/Message.ets#L10-L104
71f9c80950550d05570a4981d8f2ce1a07902dde
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
群聊列表项
export interface GroupItem { id: number; group_id: string; member_id: string; name: string; avatar: string; last_message: string; unread: number; create_time: string; update_time: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GroupItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left group_id : AST#type_annotation#Left A...
export interface GroupItem { id: number; group_id: string; member_id: string; name: string; avatar: string; last_message: string; unread: number; create_time: string; update_time: string; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L172-L182
8267da03739f7f90ab129f7fdbaf8e812de3e1ac
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SHA1.ets
arkts
safe_add
Add integers, wrapping at 2^32. This uses 16-bit operations internally to work around bugs in some JS interpreters. 将32位数拆成高16位和低16位分别进行相加,从而实现 MOD 2^32 的加法 safe_add(x: number, y: number) { let lsw = (x & 0xFFFF) + (y & 0xFFFF); let msw = (x > 16) + (y > 16) + (lsw > 16); return (msw << 16) | (lsw & 0xFFFF); }
safe_add(x: number, y: number): number { let lsw = (x & 0xFFFF) + (y & 0xFFFF); // 计算低16位的和 let msw = (x >>> 16) + (y >>> 16); // 计算高16位的和 if (lsw > 0xFFFF) { // 如果低16位和溢出 msw += 1; // 高16位加1 } return (msw << 16) | (lsw & 0xFFFF); // 组合新高16位和低16位 }
AST#method_declaration#Left safe_add AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_...
safe_add(x: number, y: number): number { let lsw = (x & 0xFFFF) + (y & 0xFFFF); let msw = (x >>> 16) + (y >>> 16); if (lsw > 0xFFFF) { msw += 1; } return (msw << 16) | (lsw & 0xFFFF); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA1.ets#L169-L176
3defcf495476a54141a2f446526f511ca5aee526
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/LoggerUtils.ets
arkts
Constructor. @param Prefix Identifies the log tag. @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
constructor(prefix: string, domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
constructor(prefix: string, domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/LoggerUtils.ets#L33-L36
2377826324e0440084da571e3c2442a52bcae1d3
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/components/imageVideoAndMedia/videoSample/VideoSample.ets
arkts
fixme:修复了视频组件全屏后,视频控制栏消失的情况,推测为被Scroll组件包裹后会出现之前的情况,目前仍出现问题为:全屏后视频播放栏与系统导航栏重合无法正常点击
build() { Column() { TitleBar({ title: $r('app.string.video_title') }) Column() { IntroductionTitle({ introduction: $r('app.string.video_show') }) Video({ src: $r('app.media.video_test'), currentProgressRate: this.videoCurrent, previewUri: $r('app.media.ic_image_alt')...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TitleBar ( AST#component_parameters#Left { AST#componen...
build() { Column() { TitleBar({ title: $r('app.string.video_title') }) Column() { IntroductionTitle({ introduction: $r('app.string.video_show') }) Video({ src: $r('app.media.video_test'), currentProgressRate: this.videoCurrent, previewUri: $r('app.media.ic_image_alt')...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/components/imageVideoAndMedia/videoSample/VideoSample.ets#L46-L162
bb50bbe0e61d15a3fbdb4d3132ce041a50346b66
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/utils/DateUtils.ets
arkts
getMonthName
获取月份的中文名称 @param month 月份(1-12) @returns 中文名称
static getMonthName(month: number): string { const names = [ '', '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月' ]; return names[month] || ''; }
AST#method_declaration#Left static getMonthName AST#parameter_list#Left ( AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static getMonthName(month: number): string { const names = [ '', '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月' ]; return names[month] || ''; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L291-L297
e87345e7bfc80f96e878755b31ef21f30e5c14ba
github
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/common/utils/AssetUtils.ets
arkts
remove
删除数据 删除成功,会通过 AppStorage 传值值变更,外部可通过 @StorageProp(key) value: string 观察值变化。 AppStorage API12 及以上支持 undefined 和 null类型。 @param key 要删除的索引 @returns Promise<AssetStoreResult> 表示添加操作的异步结果
public static async remove(key: string) { let query: asset.AssetMap = new Map(); if (canIUse("SystemCapability.Security.Asset")) { // 关键资产别名,每条关键资产的唯一索引。 // 类型为Uint8Array,长度为1-256字节。 query.set(asset.Tag.ALIAS, AssetStore.stringToArray(key)); } const result = await AssetStore.removeAsse...
AST#method_declaration#Left public static async remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_decla...
public static async remove(key: string) { let query: asset.AssetMap = new Map(); if (canIUse("SystemCapability.Security.Asset")) { query.set(asset.Tag.ALIAS, AssetStore.stringToArray(key)); } const result = await AssetStore.removeAssetMap(query); if (result.isSuccess) { hil...
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/utils/AssetUtils.ets#L126-L141
68abe799bedde282a675628c35aa729adfb2d98a
github
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
src/main/ets/constants/Index.ets
arkts
attribkey
export const EGL_ALPHA_MASK_SIZE = EGLConfigAttribute.EGL_ALPHA_MASK_SIZE;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left EGL_ALPHA_MASK_SIZE = AST#expression#Left AST#member_expression#Left AST#expression#Left EGLConfigAttribute AST#expression#Right . EGL_ALPHA_MASK_SIZE AST#member_expression#Right AST#expression#Right AST#variable_declara...
export const EGL_ALPHA_MASK_SIZE = EGLConfigAttribute.EGL_ALPHA_MASK_SIZE;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/src/main/ets/constants/Index.ets#L128-L128
0d34c841120facb2c47cb8ff71762943aa660660
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
This class encapsulates everything both Axis, Legend and LimitLines have in common.
export default abstract class ComponentBase { /** * flag that indicates if this axis / legend is enabled or not */ protected mEnabled: boolean = true; /** * the offset in pixels this component has on the x-axis */ protected mXOffset: number = 5; /** * the offset in pixels ...
AST#export_declaration#Left export default AST#class_declaration#Left abstract class ComponentBase AST#class_body#Left { /** * flag that indicates if this axis / legend is enabled or not */ AST#property_declaration#Left protected mEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
export default abstract class ComponentBase { protected mEnabled: boolean = true; protected mXOffset: number = 5; protected mYOffset: number = 5; protected mTypeface: FontWeight = FontWeight.Normal; protected mTextSize: number = 10; protected mTextColor: numbe...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L22-L177
5169f0c13ce5cefe770d10875860d081faa07a6f
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
insertOrUpdateDailySummary
==================== DAILY SUMMARY OPERATIONS ==================== Insert or update a daily summary @param summary - DailySummary object @returns Row ID
async insertOrUpdateDailySummary(summary: DailySummary): Promise<number> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { const existing = await this.getDailySummaryByDate(summary.date); const data = summary.toRow(); const valueBucket: relationalStore.Val...
AST#method_declaration#Left async insertOrUpdateDailySummary AST#parameter_list#Left ( AST#parameter#Left summary : AST#type_annotation#Left AST#primary_type#Left DailySummary AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left...
async insertOrUpdateDailySummary(summary: DailySummary): Promise<number> { if (!this.rdbStore) { throw new Error('Database not initialized'); } try { const existing = await this.getDailySummaryByDate(summary.date); const data = summary.toRow(); const valueBucket: relationalStore.Val...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L757-L791
80e3ad54ccf937ad05412479efdcfa3dfce111fe
github
wenqi1/MallHomepage.git
a09765bee60b214f73b875570f8721a004d0bc3b
entry/src/main/ets/components/Home.ets
arkts
SwiperImg
轮播图
@Builder SwiperImg() { Swiper() { ForEach(swiperImage, item => { Image(item) .width(MainPageConstants.FULL_WIDTH) .borderRadius(MainPageConstants.VP_20) .aspectRatio(MainPageConstants.ASPECT_RATIO) .backgroundColor(Color.White) }, item => JSON.stringify(it...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SwiperImg AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Swiper ( ) AST#container_content_body#Left { AST#ui_control_flow...
@Builder SwiperImg() { Swiper() { ForEach(swiperImage, item => { Image(item) .width(MainPageConstants.FULL_WIDTH) .borderRadius(MainPageConstants.VP_20) .aspectRatio(MainPageConstants.ASPECT_RATIO) .backgroundColor(Color.White) }, item => JSON.stringify(it...
https://github.com/wenqi1/MallHomepage.git/blob/a09765bee60b214f73b875570f8721a004d0bc3b/entry/src/main/ets/components/Home.ets#L67-L81
280c8dddc90f52fa126729fa25adf10da20e3699
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Scroll.ets
arkts
构建水平滚动布局 @returns {void} 无返回值
build(): void { Scroll(this.scroller) { if (this.content) { this.content(); } } .scrollBar(this.scrollBarState) .attributeModifier(this.buildScrollModifier()); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this...
build(): void { Scroll(this.scroller) { if (this.content) { this.content(); } } .scrollBar(this.scrollBarState) .attributeModifier(this.buildScrollModifier()); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Scroll.ets#L344-L352
045d8639829544c590790b67b3afb59bef5c16d9
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/pages/NavPathManager.ets
arkts
popTop
返回到最顶层(首页)
popTop(animated?: boolean) { this._navPath.popToIndex(-1, animated ?? true) }
AST#method_declaration#Left popTop AST#parameter_list#Left ( AST#parameter#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressio...
popTop(animated?: boolean) { this._navPath.popToIndex(-1, animated ?? true) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L56-L58
8662337efb96d4f696a07841557ea548ce8bd5f0
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocache/src/main/ets/model/GlobalProxyServer.ets
arkts
getServer
获取服务器 @returns
getServer(): HttpProxyCacheServer { return this.objects.get(SERVER_STR) as HttpProxyCacheServer; }
AST#method_declaration#Left getServer AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left HttpProxyCacheServer AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expr...
getServer(): HttpProxyCacheServer { return this.objects.get(SERVER_STR) as HttpProxyCacheServer; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/model/GlobalProxyServer.ets#L53-L55
80f56f1cd5e14cdced59dc6f141e61ab1e929404
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/TabContentTouchHotZone/casesfeature/tabcontentoverflow/src/main/ets/view/Side.ets
arkts
TopView
顶部视图
@Component export struct TopView { private utils = new Utils(); build() { RelativeContainer() { Image($r('app.media.tabcontentoverflow_search_icon')) .width($r('app.integer.tabcontentoverflow_search_icon_width')) .height($r('app.integer.tabcontentoverflow_search_icon_height')) .id...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TopView AST#component_body#Left { AST#property_declaration#Left private utils = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Utils AST#expression#Rig...
@Component export struct TopView { private utils = new Utils(); build() { RelativeContainer() { Image($r('app.media.tabcontentoverflow_search_icon')) .width($r('app.integer.tabcontentoverflow_search_icon_width')) .height($r('app.integer.tabcontentoverflow_search_icon_height')) .id...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/TabContentTouchHotZone/casesfeature/tabcontentoverflow/src/main/ets/view/Side.ets#L353-L462
ac23fd9cc5dd4b1cb76ab83995798a7f4c7b21aa
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PermissionUtil.ets
arkts
checkPermissions
校验当前是否已经授权 @param permissions 待判断的权限 @returns 已授权true,未授权false
static async checkPermissions(permissions: Permissions): Promise<boolean> { let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtil.checkAccessToken(permissions); if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { //判断是否授权 return true; //已经授权 } else { return fa...
AST#method_declaration#Left static async checkPermissions AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left...
static async checkPermissions(permissions: Permissions): Promise<boolean> { let grantStatus: abilityAccessCtrl.GrantStatus = await PermissionUtil.checkAccessToken(permissions); if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { return true; } else { return false; } ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L36-L43
854d96359282cdb197dd829c351c545f355b0410
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
getStatusColor
获取状态颜色
getStatusColor(): string { switch (this.status) { case InterviewStatus.SCHEDULED: return '#1890ff'; case InterviewStatus.COMPLETED: return '#52c41a'; case InterviewStatus.CANCELLED: return '#ff4d4f'; case InterviewStatus.PENDING: return '#faad14'; defaul...
AST#method_declaration#Left getStatusColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left swi...
getStatusColor(): string { switch (this.status) { case InterviewStatus.SCHEDULED: return '#1890ff'; case InterviewStatus.COMPLETED: return '#52c41a'; case InterviewStatus.CANCELLED: return '#ff4d4f'; case InterviewStatus.PENDING: return '#faad14'; defaul...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L168-L181
d21fed54813897e510b90243cf9958e2f6510ce3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/CreateRoom.ets
arkts
pushIndex
跳转至Index页面
pushIndex(): void { router.pushUrl({ url: 'pages/NewIndex', params: { 'userId': this.userId, 'socketType': this.socketType } }); }
AST#method_declaration#Left pushIndex AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Lef...
pushIndex(): void { router.pushUrl({ url: 'pages/NewIndex', params: { 'userId': this.userId, 'socketType': this.socketType } }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/CreateRoom.ets#L61-L69
8e7ef616ca9897bc2f58fc06d7b64d751fbaa06c
gitee
yanxunlarou/pal_harmony
17aeb35c98aac5f9022a952e64011578a9d14f43
entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
资源管理器
aboutToAppear() { // 监听窗口大小变化事件 this.mainWindow.on('windowSizeChange', (size: Size) => { this.setXComponentSurfaceRect(size) }) }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 监听窗口大小变化事件 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expre...
aboutToAppear() { this.mainWindow.on('windowSizeChange', (size: Size) => { this.setXComponentSurfaceRect(size) }) }
https://github.com/yanxunlarou/pal_harmony/blob/17aeb35c98aac5f9022a952e64011578a9d14f43/entry/src/main/ets/pages/Index.ets#L36-L41
f7481a7f0d7d782275afbf158491e5856ab13464
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LogUtil.ets
arkts
TODO 日志工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class LogUtil { private static logSize: number = 2048; private static domain: number = 0x0000; private static tag: string = 'harmony-utils'; //日志Tag private static showLog: boolean = true; //是否显示打印日志 private static isHilog: boolean = true; //true-hilog、false-console /** * 初始化日志参数(该方法建议在Ability里...
AST#export_declaration#Left export AST#class_declaration#Left class LogUtil AST#class_body#Left { AST#property_declaration#Left private static logSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2048 AST#expression#Right ; AST#property_d...
export class LogUtil { private static logSize: number = 2048; private static domain: number = 0x0000; private static tag: string = 'harmony-utils'; private static showLog: boolean = true; private static isHilog: boolean = true; static init(domain: number = LogUtil.domain, tag: string = LogUtil.tag,...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L27-L210
c7d4b6700e1c88b7adda1d03ccab594218ec3a66
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/auth/src/main/ets/viewmodel/LoginViewModel.ets
arkts
onLoginSuccess
登录成功处理 @param {Auth} authData - 认证数据
private async onLoginSuccess(authData: Auth) { this.userState.updateAuth(authData); this.userState.refreshUserInfo(); ToastUtils.showSuccess($r("app.string.login_success")); navigateBack(); }
AST#method_declaration#Left private async onLoginSuccess AST#parameter_list#Left ( AST#parameter#Left authData : AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#L...
private async onLoginSuccess(authData: Auth) { this.userState.updateAuth(authData); this.userState.refreshUserInfo(); ToastUtils.showSuccess($r("app.string.login_success")); navigateBack(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/auth/src/main/ets/viewmodel/LoginViewModel.ets#L55-L60
df1b7dfc39a1e6e760e91a68ff08aa5054793275
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
今日验证结果接口
export interface TodayValidationResult { isValid: boolean; solarDate: SolarDate; lunarDate?: LunarDate; backConvertedSolar?: SolarDate; message: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TodayValidationResult AST#object_type#Left { AST#type_member#Left isValid : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left solarDate : AST#typ...
export interface TodayValidationResult { isValid: boolean; solarDate: SolarDate; lunarDate?: LunarDate; backConvertedSolar?: SolarDate; message: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L73-L79
908de6d4e2d85036199a2d8860ec1885ba520642
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
isSpecSelected
判断规格是否选中 @param {number} goodsId 商品ID @param {number} specId 规格ID @returns {boolean} 是否选中
isSpecSelected(goodsId: number, specId: number): boolean { const key = `${goodsId}_${specId}`; return this.selectedSpecIds.has(key); }
AST#method_declaration#Left isSpecSelected AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
isSpecSelected(goodsId: number, specId: number): boolean { const key = `${goodsId}_${specId}`; return this.selectedSpecIds.has(key); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L130-L133
93b70b9c49463f91c735ccac99a109238d03a0e3
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets
arkts
isLogin
判断用户是否登录
isLogin(currentUser: User) { return currentUser.phone != Constants.defaultPhone && currentUser.password != Constants.defaultPassword && currentUser.userName != Constants.defaultUserName }
AST#method_declaration#Left isLogin AST#parameter_list#Left ( AST#parameter#Left currentUser : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left retur...
isLogin(currentUser: User) { return currentUser.phone != Constants.defaultPhone && currentUser.password != Constants.defaultPassword && currentUser.userName != Constants.defaultUserName }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets#L50-L53
fe1a6a0cbf6a70438c199e8e0dbc9fb24478f135
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/textInput/TextEditNodeController.ets
arkts
refreshTextScale
刷新文本缩放参数 @param scale 父节点缩放比例
refreshTextScale(scale: number): void { if (this.rootNode) { let child = this.rootNode.getFirstChild(); while (child) { if (child instanceof EditFrameNode) { (child as EditFrameNode)?.data?.refreshParentScale(scale); } child = child.getNextSibling(); } } }
AST#method_declaration#Left refreshTextScale AST#parameter_list#Left ( AST#parameter#Left scale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
refreshTextScale(scale: number): void { if (this.rootNode) { let child = this.rootNode.getFirstChild(); while (child) { if (child instanceof EditFrameNode) { (child as EditFrameNode)?.data?.refreshParentScale(scale); } child = child.getNextSibling(); } } }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextEditNodeController.ets#L74-L84
0d7eb5035fffaf02b3e8567a48dc8a64b2f62204
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
推荐算法接口
export interface RecommendationAlgorithm { name: string; version: string; type: AlgorithmType; weight: number; // 算法权重 parameters: Record<string, any>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RecommendationAlgorithm AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left version : AST#type_an...
export interface RecommendationAlgorithm { name: string; version: string; type: AlgorithmType; weight: number; parameters: Record<string, any>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/recommendation/RecommendationEngine.ets#L184-L190
949f004ef13156ef125e434fd58a7cc4f9eef84f
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets
arkts
createAudioPlayer
创建播放器并播放 Uint8Array 音频数据 @param data Uint8Array 格式的音频数据 @param idxx 音频唯一标识符 @returns 播放器实例
static async createAudioPlayer(data: Uint8Array, idxx: number, onStateChange: (state: string) =>void): Promise<media.AVPlayer | null> { try { const tempDir = AudioTool.getTmpSoundDir() createFolderIfNeeds(tempDir) const tmpName = AudioTool.Configs.TmpFmt(idxx); const filePath = ...
AST#method_declaration#Left static async createAudioPlayer AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left idxx : AST#type_annotation#Left AST#primary_type#Left number ...
static async createAudioPlayer(data: Uint8Array, idxx: number, onStateChange: (state: string) =>void): Promise<media.AVPlayer | null> { try { const tempDir = AudioTool.getTmpSoundDir() createFolderIfNeeds(tempDir) const tmpName = AudioTool.Configs.TmpFmt(idxx); const filePath = ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets#L38-L88
ec598f910bd7d2d19d15095cf2c053076085a2ac
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets
arkts
onTouchEvent
touch事件触发后绘制手指移动轨迹
onTouchEvent(event: TouchEvent): void { // 获取手指触摸位置的坐标点 const positionX: number = vp2px(event.touches[0].x); const positionY: number = vp2px(event.touches[0].y); switch (event.type) { case TouchType.Down: { // 初次绘制时创建一个新的MyRenderNode对象,用于记录和绘制手指移动的路径,后续绘制时在已创建的currentNodeDraw中重新添加路径 ...
AST#method_declaration#Left onTouchEvent AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
onTouchEvent(event: TouchEvent): void { const positionX: number = vp2px(event.touches[0].x); const positionY: number = vp2px(event.touches[0].y); switch (event.type) { case TouchType.Down: { let newNode: MyRenderNode; if (this.currentNodeDraw !== null) { this.cu...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets#L263-L296
44d8e55ce763427e0ea37063fa768d5c3b8c5d90
gitee
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/common/utils/Request.ets
arkts
put
PUT 请求 @param url 接口地址 @param data 请求体数据
static async put<T>(url: string, data?: Object): Promise<T> { // 显式传入三个泛型:<T, R, D> return instance.put<T, T, Object>(url, data); }
AST#method_declaration#Left static async put AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#R...
static async put<T>(url: string, data?: Object): Promise<T> { return instance.put<T, T, Object>(url, data); }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/common/utils/Request.ets#L49-L52
b1ad15b5e2631d1539a19ef07c3760355d19650e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/utils/TimeUtil.ets
arkts
getTimeStr
@param val 毫秒值
getTimeStr(val: number): string { if (!val || val <= 0) { return '--'; } let date = new Date(val); if (date.getUTCHours() > 0) { return this.fixZeroStart(date.getUTCHours()) + ':' + this.fixZeroStart(date.getMinutes()) + ':' + this.fixZeroStart(date.getSeconds()); } else { return t...
AST#method_declaration#Left getTimeStr AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right A...
getTimeStr(val: number): string { if (!val || val <= 0) { return '--'; } let date = new Date(val); if (date.getUTCHours() > 0) { return this.fixZeroStart(date.getUTCHours()) + ':' + this.fixZeroStart(date.getMinutes()) + ':' + this.fixZeroStart(date.getSeconds()); } else { return t...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/utils/TimeUtil.ets#L24-L34
253edb7782b68a0d9486dc46205c81727c2b64ae
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
dropTable
删除表 @param tableName 表名
async dropTable(tableName: string, targetVersion: number): Promise<void> { if (store === undefined) { return; } const deleteTableSql: string = util.format(Constants.DROP_TABLE_SQL_TEMPLATE, tableName); try { await store.executeSql(deleteTableSql); } catch (err) { logger.error(`drop...
AST#method_declaration#Left async dropTable AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetVersion : AST#type_annotation#Left AST#primary_type#Left number AST#p...
async dropTable(tableName: string, targetVersion: number): Promise<void> { if (store === undefined) { return; } const deleteTableSql: string = util.format(Constants.DROP_TABLE_SQL_TEMPLATE, tableName); try { await store.executeSql(deleteTableSql); } catch (err) { logger.error(`drop...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L113-L125
dc12ccbe2c1f115c38d56e0310244a4369afcc9f
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/dialog/DialogHelper.ets
arkts
showDialog
弹框 @param title 标题 @param message 内容 @param confirmText 确认按钮显示内容 @param operator 回调
function showDialog(title: string | Resource, message: string | Resource, confirmText?: string | Resource, operator ?: DialogOperator): void { AlertDialog.show( { title: title, message: message, confirm: { value: confirmText, action: () => { logInfo(...
AST#function_declaration#Left function showDialog AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Rig...
function showDialog(title: string | Resource, message: string | Resource, confirmText?: string | Resource, operator ?: DialogOperator): void { AlertDialog.show( { title: title, message: message, confirm: { value: confirmText, action: () => { logInfo(...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L166-L196
ad7e075cbb496cb8972ecf1356990474211d92ed
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/myCenter/readStatisticsDataList.ets
arkts
bookAuthor
作者及书名
@Builder bookAuthor(book:readBookList){ Column({space:12}){ Text(book.bookName).fontSize(16).lineHeight(24) Column(){ this.text(book.author) this.text(`累计阅读${book.readingDuration[0]}小时${book.readingDuration[1]}分钟`) }.alignItems(HorizontalAlign.Start) }.alignItems(HorizontalAlig...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bookAuthor AST#parameter_list#Left ( AST#parameter#Left book : AST#type_annotation#Left AST#primary_type#Left readBookList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bod...
@Builder bookAuthor(book:readBookList){ Column({space:12}){ Text(book.bookName).fontSize(16).lineHeight(24) Column(){ this.text(book.author) this.text(`累计阅读${book.readingDuration[0]}小时${book.readingDuration[1]}分钟`) }.alignItems(HorizontalAlign.Start) }.alignItems(HorizontalAlig...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/myCenter/readStatisticsDataList.ets#L38-L50
a30e28f652b46e64858d6f9bbed8066f469be66c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/handletabs/src/main/ets/model/constantsData.ets
arkts
Copyright (c) 2024 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, soft...
export const STYLE_CONFIGURATION: Record<string, number> = { 'TAB_BAR_HEIGHT': 48, // 页签高度 'ICON_SIZE': 16, // 图标尺寸 'TAB_BAR_CONTENT_GUTTER': 6, // 页签内元素间距 'TAB_BAR_ITEM_GUTTER': 6, // 页签间距 'SEPARATOR_STROKE_WIDTH': 2, // 分割线宽度 'CONTENT_GUTTER_M': 12, // 元素间距 'CONTENT_GUTTER_S': 8, // 元素间距 'GRID_HEIGHT'...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left STYLE_CONFIGURATION : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation...
export const STYLE_CONFIGURATION: Record<string, number> = { 'TAB_BAR_HEIGHT': 48, 'ICON_SIZE': 16, 'TAB_BAR_CONTENT_GUTTER': 6, 'TAB_BAR_ITEM_GUTTER': 6, 'SEPARATOR_STROKE_WIDTH': 2, 'CONTENT_GUTTER_M': 12, 'CONTENT_GUTTER_S': 8, 'GRID_HEIGHT': 170, 'GRID_MARGIN': 48, 'TAB_SHEET_PADDING': ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/src/main/ets/model/constantsData.ets#L16-L35
d50ecdda0f723dd8268dabf31b91f85dc2ac8413
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/player/AbstractPlayer.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2025/4/26 16:50 @Version V1.0 @Description
export abstract class AbstractPlayer { protected readonly context: Context protected readonly repository: Repository private reportingPlayback: boolean = false protected itemDto?: FinItem protected lastPosition = 0 private lastState?: media.AVPlayerState = undefined private stateChangeCallback?: me...
AST#export_declaration#Left export AST#ERROR#Left abstract class AbstractPlayer { AST#property_declaration#Left protected readonly context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left protected rea...
export abstract class AbstractPlayer { protected readonly context: Context protected readonly repository: Repository private reportingPlayback: boolean = false protected itemDto?: FinItem protected lastPosition = 0 private lastState?: media.AVPlayerState = undefined private stateChangeCallback?: me...
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/player/AbstractPlayer.ets#L13-L35
11fa3f975359a42d064204d2130fb252d61632b7
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/FriendMomentJsonUrl.ets
arkts
Copyright (c) 2023 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, soft...
export default class FriendMomentJsonUrl { public static readonly FRIEND_MOMENT_JSON_URL: Array<string> = [ 'https://gitee.com/openharmony/applications_app_samples/raw/master/code/Solutions' + '/IM/Chat/features/chatlist/src/main/resources/rawfile/mockFriendMomentOneModelData.json', 'https://gitee.com/o...
AST#export_declaration#Left export default AST#class_declaration#Left class FriendMomentJsonUrl AST#class_body#Left { AST#property_declaration#Left public static readonly FRIEND_MOMENT_JSON_URL : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Lef...
export default class FriendMomentJsonUrl { public static readonly FRIEND_MOMENT_JSON_URL: Array<string> = [ 'https://gitee.com/openharmony/applications_app_samples/raw/master/code/Solutions' + '/IM/Chat/features/chatlist/src/main/resources/rawfile/mockFriendMomentOneModelData.json', 'https://gitee.com/o...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/FriendMomentJsonUrl.ets#L16-L29
e2d30b6e75c2b3ba09ef5853d3d7a7f250fd8b12
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BubbleDataSet.ets
arkts
setHighlightCircleWidth
@Override
public setHighlightCircleWidth(width: number): void { this.mHighlightCircleWidth = Utils.handleDataValues(width); }
AST#method_declaration#Left public setHighlightCircleWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#...
public setHighlightCircleWidth(width: number): void { this.mHighlightCircleWidth = Utils.handleDataValues(width); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BubbleDataSet.ets#L33-L35
ef0f4d9b87245e1f80bb35ed5898b06f57c159fc
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BasePickerBuilderProxy.ets
arkts
buttons
弹窗按钮 位于标题栏 @param primaryButton 左侧按钮 @param secondaryButton 右侧按钮 @returns
buttons(primaryButton: ButtonOptions | ResourceStr | CustomButtonOptions, secondaryButton?: ButtonOptions | ResourceStr | CustomButtonOptions) { this.builderOptions.primaryButton = primaryButton this.builderOptions.secondaryButton = secondaryButton return this; }
AST#method_declaration#Left buttons AST#parameter_list#Left ( AST#parameter#Left primaryButton : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left CustomButtonOptions AST#primary_type...
buttons(primaryButton: ButtonOptions | ResourceStr | CustomButtonOptions, secondaryButton?: ButtonOptions | ResourceStr | CustomButtonOptions) { this.builderOptions.primaryButton = primaryButton this.builderOptions.secondaryButton = secondaryButton return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BasePickerBuilderProxy.ets#L17-L22
2c21e7bd4534b5ab9ae4bc08c5b6e0a39b18a2c3
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/PickerUtils.ets
arkts
数量 拍照、文件(文件、图片、视频、音频)选择和保存,工具类
export class PickerUtils { private constructor() {} /** * 调用系统相机,拍照、录视频 * @param options * @returns */ static async camera(options?: CameraOptions): Promise<string> { try { if (!options) { options = new CameraOptions(); } if (!options.mediaTypes || options.mediaTypes.l...
AST#export_declaration#Left export AST#class_declaration#Left class PickerUtils AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right /** * 调用系统相机,拍照、录视频 ...
export class PickerUtils { private constructor() {} static async camera(options?: CameraOptions): Promise<string> { try { if (!options) { options = new CameraOptions(); } if (!options.mediaTypes || options.mediaTypes.length == 0) { options.mediaTypes = [cameraPicker.Picke...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PickerUtils.ets#L15-L275
04f2ee2474f2cfdc82152ab750ef32011c8e026b
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment11.ets
arkts
Segment11Builder
Copyright (c) 2025 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, soft...
@Builder export function Segment11Builder() { NavDestination(){ UseWatchListener() } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function Segment11Builder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#containe...
@Builder export function Segment11Builder() { NavDestination(){ UseWatchListener() } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment11.ets#L16-L21
16f494dd41cd2e05e8b3c4fae2c1279450791ebc
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/viewmodel/MovieDataBean.ets
arkts
Movie details info bean.
export default class MovieDataBean { /** * Movie sort number */ sort: number = 0; /** * Is show sort image */ isShowSort: boolean = true; /*** * Movie sort image */ sortImage: Resource = $r('app.media.ic_first'); /** * Movie title */ title: string = '冰上姐妹'; /** * Movie descr...
AST#export_declaration#Left export default AST#class_declaration#Left class MovieDataBean AST#class_body#Left { /** * Movie sort number */ AST#property_declaration#Left sort : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#express...
export default class MovieDataBean { sort: number = 0; isShowSort: boolean = true; sortImage: Resource = $r('app.media.ic_first'); title: string = '冰上姐妹'; describe: string = '讲述冰上女运动员之间团结友爱,互帮互助的故事'; movieImage: Resource = $r('app.media.ic_movie_one'); cardImage: string = '/common/ic_...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/viewmodel/MovieDataBean.ets#L19-L60
f44a2af6a9140a1273db4be2befb87e49e622179
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/InteractAwardBuilder.ets
arkts
InteractAwardView
常用设置底部弹窗视图
@Component export struct InteractAwardView { private highlightDataSource: AwardDataSource = new AwardDataSource(); @State winners:WinnerDataSource = new WinnerDataSource(); @State settingDataSource: VHGiftAwardFiled[] = []; @State settting: VHInteractAwardSetting = new VHInteractAwardSetting; @State models:V...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InteractAwardView AST#component_body#Left { AST#property_declaration#Left private highlightDataSource : AST#type_annotation#Left AST#primary_type#Left AwardDataSource AST#primary_type#Right AST#type_annotation#Right =...
@Component export struct InteractAwardView { private highlightDataSource: AwardDataSource = new AwardDataSource(); @State winners:WinnerDataSource = new WinnerDataSource(); @State settingDataSource: VHGiftAwardFiled[] = []; @State settting: VHInteractAwardSetting = new VHInteractAwardSetting; @State models:V...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/InteractAwardBuilder.ets#L162-L651
b9f80c42af927c124db9b5ef43a16a21218edf47
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
get_all_loading_progress
Gets a list of all tabs' loading progresses. @returns A number[] array, the progresses are in the range [0, 100].
get_all_loading_progress() { let progress: number[] = []; for (let index = 0; index < this.Tabs.length; index++) { progress.push(this.Tabs[index].loading_progress); } return progress; }
AST#method_declaration#Left get_all_loading_progress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left progress : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#R...
get_all_loading_progress() { let progress: number[] = []; for (let index = 0; index < this.Tabs.length; index++) { progress.push(this.Tabs[index].loading_progress); } return progress; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L558-L565
b093b5e09ee8f406476f5a23069a2a3bc0f13380
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/navigation/OrderGraph.ets
arkts
register
注册订单模块导航路由
register(): void { RouteBuild.register(OrderRoutes.List, wrapBuilder(OrderListNav)); RouteBuild.register(OrderRoutes.Confirm, wrapBuilder(OrderConfirmNav)); RouteBuild.register(OrderRoutes.Detail, wrapBuilder(OrderDetailNav)); RouteBuild.register(OrderRoutes.Pay, wrapBuilder(OrderPayNav)); RouteBuil...
AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left...
register(): void { RouteBuild.register(OrderRoutes.List, wrapBuilder(OrderListNav)); RouteBuild.register(OrderRoutes.Confirm, wrapBuilder(OrderConfirmNav)); RouteBuild.register(OrderRoutes.Detail, wrapBuilder(OrderDetailNav)); RouteBuild.register(OrderRoutes.Pay, wrapBuilder(OrderPayNav)); RouteBuil...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/navigation/OrderGraph.ets#L19-L27
89af30b12db7bc74f0d2591af027defb069be553
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/data/ChatBox.ets
arkts
Copyright (c) 2023 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, soft...
export class ChatBox { isSend: boolean; message: string; date: string; constructor(isSend: boolean, message: string, date: string) { this.isSend = isSend; this.message = message; this.date = date; } }
AST#export_declaration#Left export AST#class_declaration#Left class ChatBox AST#class_body#Left { AST#property_declaration#Left isSend : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left message : AST#ty...
export class ChatBox { isSend: boolean; message: string; date: string; constructor(isSend: boolean, message: string, date: string) { this.isSend = isSend; this.message = message; this.date = date; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/data/ChatBox.ets#L16-L26
f887fa9cfd61c272dc78fcf99d0bda4d05d9c2c5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoPlayPage.ets
arkts
setOffCallback
移除AVPlayer事件监听
setOffCallback(): void { if (this.avPlayer) { this.avPlayer?.off('timeUpdate'); this.avPlayer?.off('videoSizeChange'); this.avPlayer?.off('stateChange'); } }
AST#method_declaration#Left setOffCallback AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_ex...
setOffCallback(): void { if (this.avPlayer) { this.avPlayer?.off('timeUpdate'); this.avPlayer?.off('videoSizeChange'); this.avPlayer?.off('stateChange'); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoPlayPage.ets#L336-L342
6d21e65c3ee56e7de019a9582bb3012549ca2b28
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
videoToGif
============================================================ 图片处理 ============================================================ 视频转 GIF @param input 输入视频路径 @param output 输出 GIF 路径 @param fps 帧率,默认 10 @param width 宽度,默认 320(保持宽高比)
public static videoToGif(input: string, output: string, fps: number = 10, width: number = 320): string[] { return [ 'ffmpeg', '-i', input, '-vf', `fps=${fps},scale=${width}:-1:flags=lanczos`, '-y', output ]; }
AST#method_declaration#Left public static videoToGif AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
public static videoToGif(input: string, output: string, fps: number = 10, width: number = 320): string[] { return [ 'ffmpeg', '-i', input, '-vf', `fps=${fps},scale=${width}:-1:flags=lanczos`, '-y', output ]; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L229-L236
5b8517c0447b99c42ad5ec053d09d89a8d66f1a6
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/pieCharts/HalfPieChartPage.ets
arkts
menuCallback
标题栏菜单回调
@Monitor("titleModel.index") menuCallback() { if (this.titleModel == null || this.titleModel == undefined) { return } let index: number = this.titleModel.getIndex() if (!this.model || index == undefined || index == -1) { return } let data = this.model.getData(); let sets: JArr...
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left "titleModel.index" AST#expression#Right ) AST#decorator#Right menuCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST...
@Monitor("titleModel.index") menuCallback() { if (this.titleModel == null || this.titleModel == undefined) { return } let index: number = this.titleModel.getIndex() if (!this.model || index == undefined || index == -1) { return } let data = this.model.getData(); let sets: JArr...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/pieCharts/HalfPieChartPage.ets#L51-L72
af8af8f2023fa7c24495fb43ea5ef626bdc8f89b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionParameter.ets
arkts
initDialogDefault
初始化DialogOptions参数 @param options
static initDialogDefault(options: DialogOptions) { options.actionCancel = options.actionCancel ?? ActionParameter.config.actionCancel; //点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。默认值:true。 if (options.title || ActionParameter.config.title) { options.title = options.title ?? ActionParameter.config.title; //弹框标题。 } ...
AST#method_declaration#Left static initDialogDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stateme...
static initDialogDefault(options: DialogOptions) { options.actionCancel = options.actionCancel ?? ActionParameter.config.actionCancel; if (options.title || ActionParameter.config.title) { options.title = options.title ?? ActionParameter.config.title; } if (options.width || ActionParameter.config...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L93-L128
1fffaa93bbf584ef3b8de79e2d885056fd9c22d5
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
getCount
MARK: - 实用方法 获取查询结果的行数 @param sql - COUNT查询语句(如:"SELECT COUNT(*) FROM users") @param params - 查询参数(可选) @returns Promise<number> 返回记录数量(出错时返回0)
async getCount(sql: string, params: ParamType[] = []): Promise<number> { const count = await this.getData<number>( sql, params, rs => rs.getLong(0) // 获取COUNT结果的第一列 ); return count ?? 0; // 空值保护 }
AST#method_declaration#Left async getCount AST#parameter_list#Left ( AST#parameter#Left sql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ParamT...
async getCount(sql: string, params: ParamType[] = []): Promise<number> { const count = await this.getData<number>( sql, params, rs => rs.getLong(0) ); return count ?? 0; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L268-L275
a5ea077a3e658828f1c029fafcb21a685dc5a89a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
setFontSizeScale
设置应用字体大小缩放比例。仅支持主线程调用。<API13+> @param fontSizeScale 表示字体缩放比例,取值为非负数。当应用字体跟随系统且该字段取值超过fontSizeMaxScale取值时,实际生效值为fontSizeMaxScale取值。
static setFontSizeScale(fontSizeScale: number) { if (AppUtil.isApiSupported(13)) { AppUtil.getApplicationContext().setFontSizeScale(fontSizeScale); } }
AST#method_declaration#Left static setFontSizeScale AST#parameter_list#Left ( AST#parameter#Left fontSizeScale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left...
static setFontSizeScale(fontSizeScale: number) { if (AppUtil.isApiSupported(13)) { AppUtil.getApplicationContext().setFontSizeScale(fontSizeScale); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L166-L170
4dd9f5ae2674df7e62e351afb9c3da553658b9e4
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/treeview/source/treeview.ets
arkts
TreeView
Declare TreeView Component @syscap SystemCapability.ArkUI.ArkUI.Full @since 10
@Component export struct TreeView { /** * Node data source of TreeView * @type TreeController * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Node data source of TreeView * @type TreeController * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TreeView AST#component_body#Left { /** * Node data source of TreeView * @type TreeController * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Node data source of TreeView * @type T...
@Component export struct TreeView { treeController: TreeController = new TreeController(); @State nodeList: NodeInfo[] = []; listNodeDataSource: ListNodeDataSource = new ListNodeDataSource(); @State item: NodeInfo[] | null = null; @State touchCount: number = 0; @State dropSelectedIndex: number = 0; ...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L977-L1046
42dc6d53ada1b714b5d2f235fb7093553bf4fb56
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getToday
获取今天的日期字符串 @returns YYYY-MM-DD 格式的今天日期
static getToday(): string { return DateUtils.formatDate(new Date(), 'YYYY-MM-DD'); }
AST#method_declaration#Left static getToday AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression...
static getToday(): string { return DateUtils.formatDate(new Date(), 'YYYY-MM-DD'); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L29-L31
9feb3481bc5e10d8841c61b434b6b3326a747985
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/result.ets
arkts
控制加载提示的显示
build() { Column() { Row() { Image($r('app.media.return')).width(50).height(50) }.width('100%') .borderWidth({ bottom: 1 }) .onClick(() => { // 点击跳转到搜索页面 router.replaceUrl({ url: 'pages/sousuo' }) // 目标页面路径 }) Scroll(){ Column() { Col...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_...
build() { Column() { Row() { Image($r('app.media.return')).width(50).height(50) }.width('100%') .borderWidth({ bottom: 1 }) .onClick(() => { router.replaceUrl({ url: 'pages/sousuo' }) }) Scroll(){ Column() { Column() { Row...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/result.ets#L50-L127
01f79554a7f3d2ad374b653b2ee21ff54b781dbc
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/objects/WebNode.ets
arkts
detachWeb
卸载Webview
detachWeb(): void { this.rootNode = null; }
AST#method_declaration#Left detachWeb AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_e...
detachWeb(): void { this.rootNode = null; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/WebNode.ets#L149-L151
d9d936079a740e8533ba800bed5fb66f730d8e5e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
getGeoAddressFromLocationName
地理编码,将地理描述转换为具体坐标集合(无需申请定位权限) @param locationName 地理位置中文描述 @param maxItems 表示返回位置信息的最大个数。 @returns @returns 编码后集合
static async getGeoAddressFromLocationName(locationName: string, maxItems: number = 1): Promise<Array<geoLocationManager.GeoAddress>> { const geocodeRequest: geoLocationManager.GeoCodeRequest = { description: locationName, //表示位置描述信息的语言,“zh”代表中文,“en”代表英文。 maxItems: maxItems, //表示返回位置信息的最大个数。取值范围为大于等于0,推...
AST#method_declaration#Left static async getGeoAddressFromLocationName AST#parameter_list#Left ( AST#parameter#Left locationName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxItems : AST#type_annotation#Left AST#prima...
static async getGeoAddressFromLocationName(locationName: string, maxItems: number = 1): Promise<Array<geoLocationManager.GeoAddress>> { const geocodeRequest: geoLocationManager.GeoCodeRequest = { description: locationName, maxItems: maxItems, locale: 'zh' }; let result = await geoLocati...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L208-L220
5ce9ea2703337115b5108e48338e831d8cf57fc2
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/ChatTools.ets
arkts
exitSystem
#ffffff'; 退出系统。 @param context UIAbilityContext上下文对象
static exitSystem(context: common.UIAbilityContext) { context.terminateSelf(); }
AST#method_declaration#Left static exitSystem AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right A...
static exitSystem(context: common.UIAbilityContext) { context.terminateSelf(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L24-L26
00eed474e3f66214330e7c1073d5e040ab52bcfe
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseEntry.ets
arkts
setData
Sets additional data this Entry should represent. @param data
public setData(data: Object): void { this.mData = data; }
AST#method_declaration#Left public setData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
public setData(data: Object): void { this.mData = data; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseEntry.ets#L89-L91
20d2b5b7b215c7e3686d1ff8e4593db7f34c6882
gitee
FantasyWind/fwrouter
eea785a7bf728862de1f88de487ef3857dee3364
router/src/main/ets/FWNavigation.ets
arkts
FWNavigation
封装系统Navigation组件,给router页面附加Navigation页面管理能力。
@Component export struct FWNavigation { // 接受外部传入的AttributeModifier类实例 @Prop modifier: NavigationModifier | null = null; @Provide('pageStack') pageStack: NavPathStack = new NavPathStack() aboutToAppear(): void { RouterManagerForNavigation.getInstance().pushNavPathStack(this.pageStack) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FWNavigation AST#component_body#Left { // 接受外部传入的AttributeModifier类实例 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right modifier : AST#type_annotation#Left AST#union_type#Left AST#primary_typ...
@Component export struct FWNavigation { @Prop modifier: NavigationModifier | null = null; @Provide('pageStack') pageStack: NavPathStack = new NavPathStack() aboutToAppear(): void { RouterManagerForNavigation.getInstance().pushNavPathStack(this.pageStack) }
https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/router/src/main/ets/FWNavigation.ets#L7-L16
e9a918d18bdd5b2e2450ea817a589625cf59b3cc
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
生产版本:移除测试联系人功能 构建页面UI
build() { Column() { // 测试文本 - 确保页面被渲染 Text('🎂 生日提醒应用 - 测试渲染') .fontSize(20) .fontWeight(FontWeight.Bold) .fontColor('#333333') .backgroundColor('#ffff00') .padding(16) .width('100%') .textAlign(TextAlign.Center) // 添加一个独立的测试Toggle Ro...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 测试文本 - 确保页面被渲染 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '🎂 生日提醒应用...
build() { Column() { Text('🎂 生日提醒应用 - 测试渲染') .fontSize(20) .fontWeight(FontWeight.Bold) .fontColor('#333333') .backgroundColor('#ffff00') .padding(16) .width('100%') .textAlign(TextAlign.Center) Row() { Text('测试开关') ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L262-L306
b092862c3a6cba326f79702d3800e178fd127d80
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
has
检查键是否存在 @param key 键 @returns 是否存在
async has(key: string): Promise<boolean> { try { this.checkInitialized(); return await this.dataPreferences!.has(key); } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to check key existence: ${businessError.message}`); ...
AST#method_declaration#Left async has AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AS...
async has(key: string): Promise<boolean> { try { this.checkInitialized(); return await this.dataPreferences!.has(key); } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to check key existence: ${businessError.message}`); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L236-L245
0cd698ac313946714ed81f00c1e81400831ade7a
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/NavigationView.ets
arkts
NavigationView
Copyright (c) 2023 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, soft...
@Component export struct NavigationView { private arr: number[] = [0, 1, 2, 3]; @State isActive: boolean = false; @State indexDev: number = 0; @Link _position: Position; private componentKey: string = ''; build() { Navigation() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (i...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavigationView AST#component_body#Left { AST#property_declaration#Left private arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_a...
@Component export struct NavigationView { private arr: number[] = [0, 1, 2, 3]; @State isActive: boolean = false; @State indexDev: number = 0; @Link _position: Position; private componentKey: string = ''; build() { Navigation() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (i...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/NavigationView.ets#L16-L78
92a41943f200d67b8335522021b69f4fee3f68a7
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets
arkts
getJSSdkDir
jssdk根目录
public getJSSdkDir(): string { return this.sandboxPath + '/jssdk'; }
AST#method_declaration#Left public getJSSdkDir AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expre...
public getJSSdkDir(): string { return this.sandboxPath + '/jssdk'; }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets#L90-L92
dee29382ad6ed46f9e64b241087b5bb91685e082
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets
arkts
isAvoidFirstLastClippingEnabled
returns true if avoid-first-lastclipping is enabled, false if not @return
public isAvoidFirstLastClippingEnabled(): boolean { return this.mAvoidFirstLastClipping; }
AST#method_declaration#Left public isAvoidFirstLastClippingEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#...
public isAvoidFirstLastClippingEnabled(): boolean { return this.mAvoidFirstLastClipping; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L121-L123
d24075e4b820449c825ac0434d14e70c87687a76
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.collections.d.ets
arkts
getLastIndexOf
Locates the last occurrence of a certain bit value within a range of bits in a bit vector. @param { number } element - Element to be Located (0 means 0, else means 1). @param { number } fromIndex - The starting position of the index, containing the value at that index position. @param { number } toIndex - The end of t...
getLastIndexOf(element: number, fromIndex: number, toIndex: number): number;
AST#method_declaration#Left getLastIndexOf AST#parameter_list#Left ( AST#parameter#Left element : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
getLastIndexOf(element: number, fromIndex: number, toIndex: number): number;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L12432-L12432
ab9b0cb3841490eb14e6c21812fc1a1e7a666307
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/networks/Http.ets
arkts
request
发起HTTP请求(返回数组数据) @param url 请求URL @param method HTTP方法 @param params 请求参数 @param callback 回调函数
static request<T>( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null, callback: (succeed: boolean, msg: string | null, data: T[] | null) => void ): void { Http._request(url, method, params, (responseData: string | null) => { if (!responseData) ...
AST#method_declaration#Left static request AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Rig...
static request<T>( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null, callback: (succeed: boolean, msg: string | null, data: T[] | null) => void ): void { Http._request(url, method, params, (responseData: string | null) => { if (!responseData) ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Http.ets#L38-L68
6e865b171b79f9a8d1a5b47e727b4796eb9baac2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusPriority.ets
arkts
FocusPrioritySample
[Start focus_priority_manage]
@Entry @Component export struct FocusPrioritySample { build() { NavDestination() { Column({ space: 12 }) { Column({ space: 8 }) { Row() { Button('Button1') .defaultFocus(true) Button('Button2') .focusScopePriority('RowScope', FocusPriori...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FocusPrioritySample AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_co...
@Entry @Component export struct FocusPrioritySample { build() { NavDestination() { Column({ space: 12 }) { Column({ space: 8 }) { Row() { Button('Button1') .defaultFocus(true) Button('Button2') .focusScopePriority('RowScope', FocusPriori...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusPriority.ets#L19-L47
0f4f5ae72568740dcf6d4cf8a1ab7e70ecb04d46
gitee
fourseas1998/hos.ArkTSComponents.git
5f0dbd0038f17067722cb035c88fe826e4846e69
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSecondGridData
获取第2个表格的数据资源
getSecondGridData(): Array<ItemData> { let secondGridData: ItemData[] = [ new ItemData($r('app.string.mainPage_top'), $r('app.media.top'), $r('app.string.mainPage_text_top')), new ItemData($r('app.string.mainPage_new'), $r('app.media.new'), $r('app.string.mainPage_text_new')), new ItemData($r('app...
AST#method_declaration#Left getSecondGridData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
getSecondGridData(): Array<ItemData> { let secondGridData: ItemData[] = [ new ItemData($r('app.string.mainPage_top'), $r('app.media.top'), $r('app.string.mainPage_text_top')), new ItemData($r('app.string.mainPage_new'), $r('app.media.new'), $r('app.string.mainPage_text_new')), new ItemData($r('app...
https://github.com/fourseas1998/hos.ArkTSComponents.git/blob/5f0dbd0038f17067722cb035c88fe826e4846e69/entry/src/main/ets/viewmodel/MainViewModel.ets#L38-L50
b33058fe4ff608fd4cd2ec43ba3b7b4e03b2abb6
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/live/LiveManager.ets
arkts
getCurrentRoom
获取当前直播间
getCurrentRoom(): LiveRoom | null { return this.currentRoom; }
AST#method_declaration#Left getCurrentRoom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LiveRoom AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left...
getCurrentRoom(): LiveRoom | null { return this.currentRoom; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/live/LiveManager.ets#L187-L189
8d1928476931c67bb8150d832b84dc6bb7daf866
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Box.ets
arkts
get
y: 第几天 (start from 0)
get num(): number { return this.pieceNo + this.distance; }
AST#method_declaration#Left get AST#ERROR#Left num AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#L...
get num(): number { return this.pieceNo + this.distance; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L38-L40
2ade2ef244d58f428ff84159420da597c2edb861
github
queyun123/weatherApp-ArkTS.git
6beee6640db32ae70c342866b24fc643a9c512bf
entry/src/main/ets/pages/Index.ets
arkts
setMockData
模拟数据(备用方案)
setMockData() { console.log('使用模拟数据'); this.temperature = '24'; this.weatherText = '晴'; this.humidity = '65%'; this.wind = '东南风'; this.windScale = '2'; this.icon = '☀️'; this.updateTime = new Date().toLocaleTimeString().substring(0, 5); }
AST#method_declaration#Left setMockData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expres...
setMockData() { console.log('使用模拟数据'); this.temperature = '24'; this.weatherText = '晴'; this.humidity = '65%'; this.wind = '东南风'; this.windScale = '2'; this.icon = '☀️'; this.updateTime = new Date().toLocaleTimeString().substring(0, 5); }
https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/pages/Index.ets#L94-L103
720b472d03ae5811ddb57edbd16bd8b5bc412f3c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets
arkts
deleteData
删除操作
public async deleteData(context: common.Context, contact: Contact): Promise<void> { logger.info(TAG, 'delete begin'); if (!context) { logger.info(TAG, 'context is null or undefined'); } const predicates = new rdb.RdbPredicates(TABLE_NAME); if (predicates === null || predicates === undefined) ...
AST#method_declaration#Left public async deleteData AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contact : ...
public async deleteData(context: common.Context, contact: Contact): Promise<void> { logger.info(TAG, 'delete begin'); if (!context) { logger.info(TAG, 'context is null or undefined'); } const predicates = new rdb.RdbPredicates(TABLE_NAME); if (predicates === null || predicates === undefined) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/OperateRDBInTaskPool/casesfeature/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L225-L251
472b862c86a58e9a58097077d1d95f965e1894dd
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogBuilder.ets
arkts
DatePickerDialogBuilder
DatePicker日期选择器弹窗view @param options
@Builder export function DatePickerDialogBuilder(options: IDateTimePickerOptions) { DatePickerDialogView({ options: options }) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function DatePickerDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IDateTimePickerOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right...
@Builder export function DatePickerDialogBuilder(options: IDateTimePickerOptions) { DatePickerDialogView({ options: options }) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L269-L272
773411ff6ba3d798f8eefb67c619213cc8416700
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/CartPage.ets
arkts
构建购物车页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.cart"), viewModel: this.vm, menus: this.vm.isEmpty ? [] : [ { value: "", icon: this.vm.isEditing ? $r("app.media.ic_success") : $r("app.media.ic_edit"), action: (): void => { ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.cart" AS...
build() { AppNavDestination({ title: $r("app.string.cart"), viewModel: this.vm, menus: this.vm.isEmpty ? [] : [ { value: "", icon: this.vm.isEditing ? $r("app.media.ic_success") : $r("app.media.ic_edit"), action: (): void => { ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CartPage.ets#L46-L90
ad490e8fa0399a1d8b5d3dc4d2257d0b6543ba8d
github
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/ability/NaturalLanguageExtract.ets
arkts
matchAppInfo
匹配应用信息
private static matchAppInfo( fullText: string, links: HuaweiLinkInfo[], appIDs: string[], dates: string[], ): AppInfo[] { const apps: AppInfo[] = []; // 处理每个链接 links.forEach((link) => { // 在链接周围寻找AppID(50字符范围内) const nearbyAppID = Natu...
AST#method_declaration#Left private static matchAppInfo AST#parameter_list#Left ( AST#parameter#Left fullText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left links : AST#type_annotation#Left AST#primary_type#Left AST#array...
private static matchAppInfo( fullText: string, links: HuaweiLinkInfo[], appIDs: string[], dates: string[], ): AppInfo[] { const apps: AppInfo[] = []; links.forEach((link) => { const nearbyAppID = NaturalLanguageExtractor.findNearbyTe...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/ability/NaturalLanguageExtract.ets#L192-L257
7f700e86e1ae1e660e91d4942afd284efdc6ce78
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setZeroLineColor
Sets the color of the zero line @param color
public setZeroLineColor(color: number): void { this.mZeroLineColor = color; }
AST#method_declaration#Left public setZeroLineColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
public setZeroLineColor(color: number): void { this.mZeroLineColor = color; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L389-L391
296c14e9a280d984fafd29211bd77351cb7f6697
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
pushForResult
@deprecated @see {ZRouter.getInstance().push} @param name @param param @param callback
public static pushForResult(name: string, param?: ObjectOrNull, callback?: OnPopCallback) { ZRouter.getRouterMgr().pushForResult<ObjectOrNull>(name, param, callback) }
AST#method_declaration#Left public static pushForResult AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left ObjectOrNul...
public static pushForResult(name: string, param?: ObjectOrNull, callback?: OnPopCallback) { ZRouter.getRouterMgr().pushForResult<ObjectOrNull>(name, param, callback) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L395-L397
39c57a6ad1833b49dd12a92b3d91cfd7f48b16cb
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/ActionSheetOptions.ets
arkts
TODO BottomSheetDialog按钮参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export class ActionSheetOptions { value: ResourceStr = ''; //按钮的内容。 fontColor?: ResourceColor; //按钮的字体颜色。 fontSize?: number | string | Resource; //按钮的文字大小,,默认16。 }
AST#export_declaration#Left export AST#class_declaration#Left class ActionSheetOptions AST#class_body#Left { AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_decl...
export class ActionSheetOptions { value: ResourceStr = ''; fontColor?: ResourceColor; fontSize?: number | string | Resource; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/ActionSheetOptions.ets#L22-L26
26d51da05b3c8cd3dfdf52f734a9f18386c967d5
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/common/utils/HttpUtils.ets
arkts
统一响应结构 Unified API Response Structure
export interface ApiResponse<T> { code: number; msg: string; data: T; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ApiResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ...
export interface ApiResponse<T> { code: number; msg: string; data: T; }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/HttpUtils.ets#L24-L28
9b6de3b0cf2bf87bc4c34af5122f7d08e178acb4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets
arkts
getData
获取索引对应的数据 @param index 数组索引 @returns
public getData(index: number): WaterFlowModule { return this.dataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WaterFlowModule AST#prima...
public getData(index: number): WaterFlowModule { return this.dataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets#L119-L121
38747909584088ce53451f9f8ef8da59182378d9
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/update/UpdateManager.ets
arkts
installUpdate
安装更新包
async installUpdate(apkPath: string): Promise<boolean> { try { Logger.info('UpdateManager', `Installing update: ${apkPath}`); if (!this.context) { throw new Error('Context not set'); } // HarmonyOS 安装需要使用 @ohos.bundle.installer // 这里提供接口定义,实际实现需要根据 HarmonyOS API 文档 ...
AST#method_declaration#Left async installUpdate AST#parameter_list#Left ( AST#parameter#Left apkPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L...
async installUpdate(apkPath: string): Promise<boolean> { try { Logger.info('UpdateManager', `Installing update: ${apkPath}`); if (!this.context) { throw new Error('Context not set'); } Logger.info('UpdateManager', 'Install com...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/update/UpdateManager.ets#L176-L198
6c9ba3e8004707e8eca853d17946ccfed0d91ab5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/component/HomeCategorySection.ets
arkts
getImageRadius
获取分类图标圆角 @returns {number} 图标圆角
private getImageRadius(): number { const size: number = this.getImageSize(); return size / 2; }
AST#method_declaration#Left private getImageRadius AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ...
private getImageRadius(): number { const size: number = this.getImageSize(); return size / 2; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCategorySection.ets#L112-L115
48e0b75fa809f0c96811d9561abbf02c60dc5199
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Transition animation duration.
export const TRANSITION_ANIMATION_DURATION: number = 600;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TRANSITION_ANIMATION_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 600 AST#expression#Right AST#variable_declarator#Right ; AST#va...
export const TRANSITION_ANIMATION_DURATION: number = 600;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L43-L43
0dccc80405b6854afaf42de83a906171079da649
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
窗口创建时调用 加载入口页面、初始化UI基础样式 @param {window.WindowStage} windowStage - 窗口阶段 @returns {Promise<void>} 无返回值的Promise
async onWindowStageCreate(windowStage: window.WindowStage): Promise<void> { await this.initIBestORM(); windowStage.loadContent('view/EntryPage', (_) => { IBestUIInitializer.initIBestUI(windowStage, this.context); }); }
AST#method_declaration#Left async onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#...
async onWindowStageCreate(windowStage: window.WindowStage): Promise<void> { await this.initIBestORM(); windowStage.loadContent('view/EntryPage', (_) => { IBestUIInitializer.initIBestUI(windowStage, this.context); }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/entryability/EntryAbility.ets#L44-L49
037aeca5d18bfcc6ddcccacce13e5fc3eeca8eaa
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildDataManagement
数据管理
@Builder buildDataManagement() { Column({ space: 16 }) { Text('💾 数据管理') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .alignSelf(ItemAlign.Start) // 数据统计概览 this.buildDataOverview() Column({ space: 12 }) { this.bu...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDataManagement AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component...
@Builder buildDataManagement() { Column({ space: 16 }) { Text('💾 数据管理') .fontSize(18) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .alignSelf(ItemAlign.Start) this.buildDataOverview() Column({ space: 12 }) { this.buildDataAc...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3571-L3608
87e39c2389a2bf42e4f64a2ac3920775248c6147
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/modifier/NavAnimationModifier.ets
arkts
@author: HHBin @date: 2024-11-14 @desc: 导航动态属性设置
export class NavAnimationModifier extends AttributeUpdater<NavDestinationAttribute, NavDestinationInterface> { }
AST#export_declaration#Left export AST#class_declaration#Left class NavAnimationModifier extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeUpdater AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NavDestinationAttribute AST#primary_type#Right AST#type_annotati...
export class NavAnimationModifier extends AttributeUpdater<NavDestinationAttribute, NavDestinationInterface> { }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/modifier/NavAnimationModifier.ets#L8-L9
01e491215ea967c00cbeaa726d23d61ee751b352
gitee
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
time_bar/src/main/ets/components/viewModel/TimeBarModel.ets
arkts
get
Get the valid time bounds for the timeline (derived from timeRange). @returns An object containing minTime and maxTime.
get timeBounds(): VideoTimeBounds { return { minTime: this._minTime, maxTime: this._maxTime }; }
AST#method_declaration#Left get AST#ERROR#Left timeBounds AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left VideoTimeBounds AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ...
get timeBounds(): VideoTimeBounds { return { minTime: this._minTime, maxTime: this._maxTime }; }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/viewModel/TimeBarModel.ets#L105-L110
d2ccddf989f55ba00efccf15d8c1bdc514fe2004
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
arkts
notifyDataMove
通知控制器数据位置变化
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L61-L65
cd252fee030d4710dba5b931ac47c910b19cbbb4
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/common/MediaRouter.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/19 23:18 @Version V1.0 @Description
export class MediaRouter { public static openDetail(item: FinItem) { if (item.type === FinItemType.Movie) { let args: DetailArgs = { id: item.id, name: item.name } router.pushUrl({url: "pages/detail/movie/MoviePage", params: args}) } else if (item.type === FinItemType.Series...
AST#export_declaration#Left export AST#class_declaration#Left class MediaRouter AST#class_body#Left { AST#method_declaration#Left public static openDetail AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left FinItem AST#primary_type#Right AST#type_annotation#Right AST#param...
export class MediaRouter { public static openDetail(item: FinItem) { if (item.type === FinItemType.Movie) { let args: DetailArgs = { id: item.id, name: item.name } router.pushUrl({url: "pages/detail/movie/MoviePage", params: args}) } else if (item.type === FinItemType.Series...
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/common/MediaRouter.ets#L13-L38
cbab2b49feecc2af77fc423f389338476c94d6c2
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowAppSettings.ets
arkts
on_open_or_close_panel
Events
on_open_or_close_panel() { if (this.showing_app_settings) { // Open panel this.on_panel_open(); } else { // Close panel this.on_panel_close(); } }
AST#method_declaration#Left on_open_or_close_panel AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showing_app_settings AST#member_e...
on_open_or_close_panel() { if (this.showing_app_settings) { this.on_panel_open(); } else { this.on_panel_close(); } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowAppSettings.ets#L1501-L1509
08db73b7a9f85321f9bedd975b39de6b58182765
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/MainViewModel.ets
arkts
aboutToAppear
页面出现时触发动画同步 @returns {void} 无返回值
aboutToAppear(): void { super.aboutToAppear(); this.syncCurrentAnimation(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { super.aboutToAppear(); this.syncCurrentAnimation(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L90-L93
1b037397cbb990510c63d847e28e0e7c11db76d5
github
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/index.ets
arkts
IoTDevice
Copyright 2024 Huawei Cloud IoT Authors 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, softwa...
export { IoTDevice } from './src/main/ets/IoTDevice';
AST#export_declaration#Left export { IoTDevice } from './src/main/ets/IoTDevice' ; AST#export_declaration#Right
export { IoTDevice } from './src/main/ets/IoTDevice';
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/index.ets#L15-L15
20b6501000ce21619693566c2129343494772605
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/home/trainMusic.ets
arkts
itemui
************************************音乐列表*********************************************//
@Builder itemui(item: musicItem , index: number){ Row(){ Text(item.title).padding(15).fontSize(15).width('50%') if (this.currentSelectedIndex === index) { Image(item.img) .width(20) .height(20) .fillColor('#007AFF') // 选中时蓝色 } // 根据状态切换颜色 }.width('100%')...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right itemui AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left musicItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#...
@Builder itemui(item: musicItem , index: number){ Row(){ Text(item.title).padding(15).fontSize(15).width('50%') if (this.currentSelectedIndex === index) { Image(item.img) .width(20) .height(20) .fillColor('#007AFF') } }.width('100%').justifyContent(Fle...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/trainMusic.ets#L47-L61
33f98aed558c45c0641afe0b1e0373987ad39179
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets
arkts
notifyDataChange
通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件
notifyDataChange(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataChange(index); }) }
AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
notifyDataChange(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataChange(index); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets#L61-L65
28709c54aa60a913cf9f44c544c20f5df2a3796b
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/ECDSA.ets
arkts
@Author csx @DateTime 2024/3/20 20:05 @TODO ECDSA
export class ECDSA { /** * 生成ECDSA的非对称密钥 * @returns ECDSA密钥{publicKey:公钥,privateKey:私钥} */ static async generateECDSAKey(): Promise<OutDTO<CryptoKey>> { return CryptoUtil.generateCryptoKey('ECC256'); } /** * 签名 * @param str 需要签名的字符串 * @param priKey 私钥 * @returns OutDTO<string> 签名对象 ...
AST#export_declaration#Left export AST#class_declaration#Left class ECDSA AST#class_body#Left { /** * 生成ECDSA的非对称密钥 * @returns ECDSA密钥{publicKey:公钥,privateKey:私钥} */ AST#method_declaration#Left static async generateECDSAKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#pri...
export class ECDSA { static async generateECDSAKey(): Promise<OutDTO<CryptoKey>> { return CryptoUtil.generateCryptoKey('ECC256'); } static async sign(str: string, priKey: string): Promise<OutDTO<string>> { return CryptoUtil.sign(str, priKey, 'ECC256', 'ECC256|SHA256', 256); } static async ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/ECDSA.ets#L26-L56
bf6b36a5fe3348f596df8bf9d13fcc9ece6020d2
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/UserService.ets
arkts
close
关闭服务
async close(): Promise<void> { await this.cloudDBService.close(); this.currentUser = null; }
AST#method_declaration#Left async close AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#...
async close(): Promise<void> { await this.cloudDBService.close(); this.currentUser = null; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L219-L222
b1f6d1837e220ad892845b5f049fe3142df4baae
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets
arkts
exchangeIconAnimationFunction
图标旋转动画
exchangeIconAnimationFunction(): void { // 图标一次旋转的角度 const rotateAddAngle: number = 180; animateTo({ curve: curves.springMotion() }, () => { this.rotateAngle += rotateAddAngle; }) }
AST#method_declaration#Left exchangeIconAnimationFunction AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 图标一次旋转的角度 AST#statement#Left AST#variable_declaration#Left const AST#variabl...
exchangeIconAnimationFunction(): void { const rotateAddAngle: number = 180; animateTo({ curve: curves.springMotion() }, () => { this.rotateAngle += rotateAddAngle; }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets#L190-L196
40354e2e0bbca9a2495ae218357b3468976a3dbb
gitee