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
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogBuilder.ets
arkts
LoadingProgressBuilder
LoadingProgress
@Builder export function LoadingProgressBuilder(options: LoadingProgressOptions) { LoadingProgressView({ options: options }); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LoadingProgressBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left LoadingProgressOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ...
@Builder export function LoadingProgressBuilder(options: LoadingProgressOptions) { LoadingProgressView({ options: options }); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L205-L208
ec1e267e50a02a15a547651ffd735ab4f6883c66
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets
arkts
This is the base dataset of all DataSets. It's purpose is to implement critical methods provided by the IDataSet interface.
export default abstract class BaseDataSet<T extends EntryOhos> implements IDataSet<T> { /** * List representing all colors that are used for this DataSet */ protected mColors: JArrayList<Number>; /** * List representing all colors that are used for drawing the actual values for this DataSet */ prot...
AST#export_declaration#Left export default AST#class_declaration#Left abstract class BaseDataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST...
export default abstract class BaseDataSet<T extends EntryOhos> implements IDataSet<T> { protected mColors: JArrayList<Number>; protected mValueColors: JArrayList<Number> = null; private mLabel: string = 'DataSet'; protected mAxisDependency: AxisDependency = AxisDependency.LEFT; protected mH...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets#L33-L526
11fe152e02e7461ab33a58a7acdb697375f28976
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
更新梦想 @param id 梦想ID @param dream 梦想数据 @returns 更新后的梦想
export function updateDream(id: number, dream: Dream): Promise<Dream> { console.info(`开始更新梦想: ${dream.title}`); try { // 转换为符合请求数据类型的对象 const requestData: RequestData = { userId: dream.userId, title: dream.title, description: dream.description, category: dream.category, priorit...
AST#export_declaration#Left export AST#function_declaration#Left function updateDream AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dream : AST#type_annotation#Left AST#pri...
export function updateDream(id: number, dream: Dream): Promise<Dream> { console.info(`开始更新梦想: ${dream.title}`); try { const requestData: RequestData = { userId: dream.userId, title: dream.title, description: dream.description, category: dream.category, priority: dream.priority...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L548-L592
afb4ba6accc716ff0d5b08b444175f248d82e08c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagegridlayout/src/main/ets/components/mainpage/ImageGridLayout.ets
arkts
ImageGridLayoutComponent
功能描述: 本示例介绍使用Flex组件实现图片在不同个数情况下的布局效果(默认布局和自定义布局)。 推荐场景: 社交类应用 核心组件: 1. MultiGrid - 图片布局视图 实现步骤: 1. 初始化数据。 private imageArray1: Resource[] = [$r("app.media.b")]; private imageArray3: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c")]; private imageArray4: Resource[] = [$r("app.media.a"), $r("app.m...
@Component export struct ImageGridLayoutComponent { // 不同图片数量的图片集合 private imageArray1: Resource[] = [$r("app.media.b")]; private imageArray3: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c")]; private imageArray4: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("a...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageGridLayoutComponent AST#component_body#Left { // 不同图片数量的图片集合 AST#property_declaration#Left private imageArray1 : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Righ...
@Component export struct ImageGridLayoutComponent { private imageArray1: Resource[] = [$r("app.media.b")]; private imageArray3: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c")]; private imageArray4: Resource[] = [$r("app.media.a"), $r("app.media.b"), $r("app.media.c"), $r("app.media.d")];...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagegridlayout/src/main/ets/components/mainpage/ImageGridLayout.ets#L47-L68
ee83115b03db6782c80b6789b7a9446f1add7e55
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/xcomponentvsync/Index.ets
arkts
XcomponentVsyncComponent
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 { XcomponentVsyncComponent } from './src/main/ets/pages/XcomponentVsync';
AST#export_declaration#Left export { XcomponentVsyncComponent } from './src/main/ets/pages/XcomponentVsync' ; AST#export_declaration#Right
export { XcomponentVsyncComponent } from './src/main/ets/pages/XcomponentVsync';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/xcomponentvsync/Index.ets#L15-L15
1e767b3ef5b3f5f2681bfe9223d8cecf1426f57e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialog.ets
arkts
CreateDialog
[Start click_event_pop_dialog] [Start create_custom_dialog_controller]
@Entry @Component export struct CreateDialog { dialogController: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample(), }) // [StartExclude create_custom_dialog_controller] build() { NavDestination() { Column({ space: 12 }) { Column() { Button('cl...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct CreateDialog AST#component_body#Left { AST#property_declaration#Left dialogController : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_...
@Entry @Component export struct CreateDialog { dialogController: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample(), }) build() { NavDestination() { Column({ space: 12 }) { Column() { Button('click me') .onClick(() => { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/customdialog/CreateCustomDialog.ets#L42-L72
82697d0414b2eb3e161cd756f7e8baa589a56bd3
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/auth/AuthService.ets
arkts
register
注册
async register(params: RegisterParams): Promise<boolean> { try { Logger.info('AuthService', `Register attempt: ${params.username}`); // Mock 注册 // const response = await Http.post('/api/auth/register', params); // Mock 响应 const mockUser: UserInfo = { id: '1', ...
AST#method_declaration#Left async register AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left RegisterParams 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...
async register(params: RegisterParams): Promise<boolean> { try { Logger.info('AuthService', `Register attempt: ${params.username}`); const mockUser: UserInfo = { id: '1', username: params.username, email: params.email }; const...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L126-L170
6a8ec746beae416d7ff8aea56efa93135472b11f
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.FormMenu.d.ets
arkts
Defines the add form options. @interface AddFormOptions @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export interface AddFormOptions { /** * Indicates the form data. * * @type { ?formBindingData.FormBindingData } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ formBindingData?: formBindingData.FormBindingData; /** * The callback is used to return the form id. ...
AST#export_declaration#Left export AST#interface_declaration#Left interface AddFormOptions AST#object_type#Left { /** * Indicates the form data. * * @type { ?formBindingData.FormBindingData } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#type_member#Left formBindin...
export interface AddFormOptions { formBindingData?: formBindingData.FormBindingData; callback?: AsyncCallback<string>; style?: FormMenuItemStyle; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FormMenu.d.ets#L53-L83
ec6fb78b518143689feae114634cdfa3097db679
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets
arkts
currentBmiColor
BMI 根据值查颜色
currentBmiColor(currentVal: number):BmiTable { return DxinConstants.bmiTableArr.find((item:BmiTable) => currentVal >= item.min && currentVal <= item.max) as BmiTable }
AST#method_declaration#Left currentBmiColor AST#parameter_list#Left ( AST#parameter#Left currentVal : 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 BmiTable AST#primar...
currentBmiColor(currentVal: number):BmiTable { return DxinConstants.bmiTableArr.find((item:BmiTable) => currentVal >= item.min && currentVal <= item.max) as BmiTable }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinBmiUtil.ets#L7-L9
d4dae6a9dcc64139c6b7d3a0204fafc55abe12b8
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets
arkts
获取当前星期几的中文表示 @returns 星期几的中文表示
export function getDayOfWeekChinese(): string { const weekDays = ['日', '一', '二', '三', '四', '五', '六']; const day = new Date().getDay(); return `星期${weekDays[day]}`; }
AST#export_declaration#Left export AST#function_declaration#Left function getDayOfWeekChinese 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#variable_declarati...
export function getDayOfWeekChinese(): string { const weekDays = ['日', '一', '二', '三', '四', '五', '六']; const day = new Date().getDay(); return `星期${weekDays[day]}`; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets#L112-L116
3a1a0601c342aa67056c0d2f7d896934662a1597
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets
arkts
createRdbStore
Create rdb store @param {context} Context @return {globalThis.rdbStore} return rdbStore RDB database
async createRdbStore(context: Context) { if (!GlobalContext.getContext().getObject('rdbStore')) { await DataRdb.getRdbStore(context, CommonConstants.RDB_STORE_CONFIG) .then((rdbStore: DataRdb.RdbStore) => { if (rdbStore) { rdbStore.executeSql(CommonConstants.CREATE_TABLE_FORM).ca...
AST#method_declaration#Left async createRdbStore AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context 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 AST#ui_...
async createRdbStore(context: Context) { if (!GlobalContext.getContext().getObject('rdbStore')) { await DataRdb.getRdbStore(context, CommonConstants.RDB_STORE_CONFIG) .then((rdbStore: DataRdb.RdbStore) => { if (rdbStore) { rdbStore.executeSql(CommonConstants.CREATE_TABLE_FORM).ca...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets#L41-L59
771eb702f07ac2aee8ac185a54b3226f54b7d29e
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/DictDataRequest.ets
arkts
@file 字典数据请求 @author Joker.X
export class DictDataRequest { /** * 字典类型列表 */ types: string[] = []; /** * @param {DictDataRequest} init - 初始化数据 */ constructor(init?: DictDataRequest) { if (init) { this.types = init.types; } } }
AST#export_declaration#Left export AST#class_declaration#Left class DictDataRequest AST#class_body#Left { /** * 字典类型列表 */ AST#property_declaration#Left types : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#...
export class DictDataRequest { types: string[] = []; constructor(init?: DictDataRequest) { if (init) { this.types = init.types; } } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/DictDataRequest.ets#L5-L19
e99c78ed82ef0e4d44ee24f3b7bcef8ee6170969
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/MultiColumnDisplayPage.ets
arkts
MultiColumnDisplayComponent
功能描述:本示例中,多段不同列数混合布局的数据在瀑布流容器中可以正常显示 推荐场景:购物APP展示商品时使用 核心组件: 1.WaterFlow 2.LazyForEach 实现步骤: 1.构造瀑布流中展示的所有数据 2.配置瀑布流组件sections属性,设置数据在一列或者两列时的列数,列间距等属性 3.使用WaterFlow组件展示数据
@Component export struct MultiColumnDisplayComponent { @State dataSource: WaterFlowDataSource = new WaterFlowDataSource(waterFlowData); // 瀑布流分组信息 @State sections: WaterFlowSections = new WaterFlowSections(); // 瀑布流数据个数 dataCount: number = waterFlowData.length; // 双列时,图片较小的瀑布流子组件高度 private shortDisplayHei...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MultiColumnDisplayComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right dataSource : AST#type_annotation#Left AST#primary_type#Left WaterFlowDataSource AST#pr...
@Component export struct MultiColumnDisplayComponent { @State dataSource: WaterFlowDataSource = new WaterFlowDataSource(waterFlowData); @State sections: WaterFlowSections = new WaterFlowSections(); dataCount: number = waterFlowData.length; private shortDisplayHeight: number = 155; private highDisp...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/MultiColumnDisplayPage.ets#L34-L113
bf3496f75077bbc38a686b2774d9ff3dab01e4ee
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TransitionAnimation/entry/src/main/ets/pages/CustomTransition.ets
arkts
pageTransition
Page transition parameters are configured using the global pageTransition method. The transparency is set from 0.2 to 1 when entering the site. The x and y axes are scaled from 0 to 1. The offset of the x and y axes at exit is 500.
pageTransition() { PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth }) .opacity(CUSTOM_TRANSITION_OPACITY) .scale(CUSTOM_TRANSITION_SCALE) PageTransitionExit({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth }) .translate(CUSTOM_TRANSITION_TRANSLA...
AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression...
pageTransition() { PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth }) .opacity(CUSTOM_TRANSITION_OPACITY) .scale(CUSTOM_TRANSITION_SCALE) PageTransitionExit({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth }) .translate(CUSTOM_TRANSITION_TRANSLA...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/pages/CustomTransition.ets#L39-L45
f3338e7b6c0b38c1265ef2af9465f04642101809
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/components/common/LoadingView.ets
arkts
LoadingView
通用加载视图组件 提供统一的加载状态展示
@Component export struct LoadingView { @Prop message: string = '加载中...'; @Prop sizeValue: number = 32; @Prop textColorStr: string = '#666666'; @Prop backgroundColorStr: string = 'transparent'; @Prop showBackground: boolean = false; build() { Column({ space: 16 }) { // 加载动画 LoadingProgress()...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotat...
@Component export struct LoadingView { @Prop message: string = '加载中...'; @Prop sizeValue: number = 32; @Prop textColorStr: string = '#666666'; @Prop backgroundColorStr: string = 'transparent'; @Prop showBackground: boolean = false; build() { Column({ space: 16 }) { LoadingProgress() ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/LoadingView.ets#L6-L34
ab984c12df9a9a698c1eaa8da61b48630b0bc30e
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
setNavBgColor
设置背景色 @param color 颜色 @returns
public setNavBgColor(color: ResourceColor) { this._navBgColor = color return this }
AST#method_declaration#Left public setNavBgColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_...
public setNavBgColor(color: ResourceColor) { this._navBgColor = color return this }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L228-L231
2b75866eb209e0caffc44d85bc1c3934f5d61534
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/ImageViewComponent.ets
arkts
detectBoundary
Detect boundary to keep the image in window.
detectBoundary(): void { let maxOffsetX = this.imgScale * this.deviceWidth / 2 - this.deviceWidth / 2; if (this.getUIContext().vp2px(this.imgOffsetX) > (maxOffsetX)) { this.imgOffsetX = this.getUIContext().px2vp(maxOffsetX); } if (this.getUIContext().vp2px(this.imgOffsetX) < -(maxOffsetX)) { ...
AST#method_declaration#Left detectBoundary 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 let AST#variable_declarator#Left maxOffsetX =...
detectBoundary(): void { let maxOffsetX = this.imgScale * this.deviceWidth / 2 - this.deviceWidth / 2; if (this.getUIContext().vp2px(this.imgOffsetX) > (maxOffsetX)) { this.imgOffsetX = this.getUIContext().px2vp(maxOffsetX); } if (this.getUIContext().vp2px(this.imgOffsetX) < -(maxOffsetX)) { ...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/ImageViewComponent.ets#L72-L91
269869c61e19beb081a7ea6808bfbf85e6c723ad
github
Musicys/ArktsShop.git
1e2f77b90766f9dfd5ad94063aad7684befbbc07
hwsc/entry/src/main/ets/store/user.ets
arkts
setUser
安全更新用户信息(Partial 更新)
setUser(partial: Partial<UserInfo>): void { this.userInfo = { id: partial.id !== undefined ? partial.id : this.userInfo.id, username: partial.username !== undefined ? partial.username : this.userInfo.username, name: partial.name !== undefined ? partial.name : this.userInfo.name, url: partial...
AST#method_declaration#Left setUser AST#parameter_list#Left ( AST#parameter#Left partial : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#...
setUser(partial: Partial<UserInfo>): void { this.userInfo = { id: partial.id !== undefined ? partial.id : this.userInfo.id, username: partial.username !== undefined ? partial.username : this.userInfo.username, name: partial.name !== undefined ? partial.name : this.userInfo.name, url: partial...
https://github.com/Musicys/ArktsShop.git/blob/1e2f77b90766f9dfd5ad94063aad7684befbbc07/hwsc/entry/src/main/ets/store/user.ets#L49-L59
e3979c15d5c7966cc18904af959316110da33e9a
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets
arkts
Declaration of the tab item. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declaration of the tab item. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export declare class TabTitleBarTabItem { /** * Text description for this tab item. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Text description for this tab item. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkU...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TabTitleBarTabItem AST#class_body#Left { /** * Text description for this tab item. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Text descr...
export declare class TabTitleBarTabItem { title: ResourceStr; icon?: ResourceStr; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets#L93-L122
8f6ed7cc9a634bd16b9b248fc16d58c8030cb19e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/IndicatorAniamtionInfo.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 interface IndicatorAnimationInfo { // 背景条左边距 left: number; // 页签条便宜 offset: number; // 背景条高度 height: number; // 背景条宽度 width: number; // 是否初始化(true: 已初始化, false: 未初始化) flag: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IndicatorAnimationInfo AST#object_type#Left { // 背景条左边距 AST#type_member#Left left : 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 off...
export interface IndicatorAnimationInfo { left: number; offset: number; height: number; width: number; flag: boolean; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/IndicatorAniamtionInfo.ets#L16-L27
21b7bc43e35accb3f2791f9b306ea9345cc0c706
gitee
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/renderer/AxisRenderer.ets
arkts
computeAxis
Computes the axis values. @param min - the minimum value in the data object for this axis @param max - the maximum value in the data object for this axis
public computeAxis(min: number, max: number, inverted: boolean) { // calculate the starting and entry point of the y-labels (depending on // zoom / contentrect bounds) if (this.mTrans && this.mViewPortHandler != null && this.mViewPortHandler.contentWidth() > 10 && !this.mViewPortHandler.isFullyZoomedOutY()...
AST#method_declaration#Left public computeAxis AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R...
public computeAxis(min: number, max: number, inverted: boolean) { if (this.mTrans && this.mViewPortHandler != null && this.mViewPortHandler.contentWidth() > 10 && !this.mViewPortHandler.isFullyZoomedOutY()) { let p1: MPPointD | undefined = this.mTrans.getValuesByTouchPoint(this.mViewPortHandler.co...
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/renderer/AxisRenderer.ets#L120-L146
b44da434d60720044fa8acf1e47618334c49a92f
github
yinxing2008/2048-hongmeng-ark-ts.git
fe0cb8e36e7456445464e18b39de2bd17eb27346
2048_hongmeng_ArkTS/entry/src/main/ets/MainAbility/model/GameDataSource.ets
arkts
厦门大学计算机专业 | 前华为工程师 专注《零基础学编程系列》 http://lblbc.cn/blog 包含:Java | 安卓 | 前端 | Flutter | iOS | 小程序 | 鸿蒙 公众号:蓝不蓝编程
export class GameDataSource implements IDataSource { public dataArray: string[][] = [] constructor
AST#export_declaration#Left export AST#ERROR#Left class GameDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right { public dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Righ...
export class GameDataSource implements IDataSource { public dataArray: string[][] = [] constructor
https://github.com/yinxing2008/2048-hongmeng-ark-ts.git/blob/fe0cb8e36e7456445464e18b39de2bd17eb27346/2048_hongmeng_ArkTS/entry/src/main/ets/MainAbility/model/GameDataSource.ets#L7-L10
f3a18445d7f110decb8fbfc86b95548b8581c241
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/Search.ets
arkts
handleSearch
处理搜索逻辑
async handleSearch() { if (!this.keyword.trim()) { promptAction.showToast({ message: '请输入搜索内容' }) return } try { let request = http.createHttp() let url = `http://192.168.32.1:8080/api/search?keyword=${encodeURIComponent(this.keyword)}` let response = await request.request(ur...
AST#method_declaration#Left async handleSearch AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expr...
async handleSearch() { if (!this.keyword.trim()) { promptAction.showToast({ message: '请输入搜索内容' }) return } try { let request = http.createHttp() let url = `http://192.168.32.1:8080/api/search?keyword=${encodeURIComponent(this.keyword)}` let response = await request.request(ur...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Search.ets#L19-L68
8369a55e7c8bbb9c88fc55b009bcf2ed6003d054
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
initConfirmButton
一个按钮,初始化参数 @param options
private static initConfirmButton(options: ConfirmDialogOptions) { options.confirm = options.confirm ?? DialogUtil.defaultConfig.secondaryButton; if (TypeUtil.isResourceStr(options.confirm)) { options.confirm = { value: options.confirm as ResourceStr, action: () => { if (options.o...
AST#method_declaration#Left private static initConfirmButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ConfirmDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#exp...
private static initConfirmButton(options: ConfirmDialogOptions) { options.confirm = options.confirm ?? DialogUtil.defaultConfig.secondaryButton; if (TypeUtil.isResourceStr(options.confirm)) { options.confirm = { value: options.confirm as ResourceStr, action: () => { if (options.o...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L272-L295
99ed2ece1cf8b4016305e6c00cd585760e678039
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineRadarDataSet.ets
arkts
setLineWidth
set the line width of the chart (min = 0.2f, max = 10f); default 1f NOTE: thinner line == better performance, thicker line == worse performance @param width
public setLineWidth(width: number): void { if (width < 0.0) { width = 0.0; } if (width > 10.0) { width = 10.0; } this.mLineWidth = width; }
AST#method_declaration#Left public setLineWidth 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#primary_typ...
public setLineWidth(width: number): void { if (width < 0.0) { width = 0.0; } if (width > 10.0) { width = 10.0; } this.mLineWidth = width; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineRadarDataSet.ets#L120-L128
a8cfc053f1526cc1e262d5c35b3f7be9876a8957
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets
arkts
getPreferencesFromStorage
Read the specified Preferences persistence file and load the data into the Preferences instance.
async getPreferencesFromStorage() { try { preference = await dataPreferences.getPreferences(context, CommonConstants.PREFERENCES_NAME); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to get preferences, Cause: ${err}`); } }
AST#method_declaration#Left async getPreferencesFromStorage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left prefere...
async getPreferencesFromStorage() { try { preference = await dataPreferences.getPreferences(context, CommonConstants.PREFERENCES_NAME); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to get preferences, Cause: ${err}`); } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L37-L43
a2364ef07b5921a4e8191c953c2cea9861ddef79
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets
arkts
onChangeRecord
录制 暂停/开始
async onChangeRecord(): Promise<void> { Logger.info(TAG, `onChangeRecord isRecording: ${this.isRecording}`); if (this.isRecording) { // 开始 await this.resumeVideo(); } else { // 暂停 if (this.timer !== undefined) { clearInterval(this.timer); Logger.debug(TAG, `onChangeRe...
AST#method_declaration#Left async onChangeRecord 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_a...
async onChangeRecord(): Promise<void> { Logger.info(TAG, `onChangeRecord isRecording: ${this.isRecording}`); if (this.isRecording) { await this.resumeVideo(); } else { if (this.timer !== undefined) { clearInterval(this.timer); Logger.debug(TAG, `onChangeRecord clear...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets#L99-L113
732a54dd1eb8df4779604c76852261feae6599cd
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
checkDayOfUsable
/ 检查 dayOf 是否可用
public checkDayOfUsable(curDayOfNum: number, showMessage: boolean = true): boolean { if (this.isActive) { return true } // 非会员才做检查 if (this.maxFreePlanDayOfsCount < curDayOfNum) { if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_use_all_plan_dayofs')) } ret...
AST#method_declaration#Left public checkDayOfUsable AST#parameter_list#Left ( AST#parameter#Left curDayOfNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left bool...
public checkDayOfUsable(curDayOfNum: number, showMessage: boolean = true): boolean { if (this.isActive) { return true } if (this.maxFreePlanDayOfsCount < curDayOfNum) { if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_use_all_plan_dayofs')) } return false ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L273-L284
e706240f1f0192b4cec65854ba026057756a7517
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/component/TextInputDialogView.ets
arkts
getString
获取指定资源对应的字符串 @param res
private getString(res: Resource): string { return ArkWebHelper.getContext().resourceManager.getStringSync(res); }
AST#method_declaration#Left private getString AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left Resource 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_typ...
private getString(res: Resource): string { return ArkWebHelper.getContext().resourceManager.getStringSync(res); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/component/TextInputDialogView.ets#L257-L259
6b476221be206de2e8dcb1662cc9a2e098ac6daa
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AES.ets
arkts
generateAESKey128
生成AES的对称密钥-128位 @returns AES密钥-128位
static async generateAESKey128(): Promise<string> { return CryptoUtil.generateSymKey('AES128'); }
AST#method_declaration#Left static async generateAESKey128 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 string AST#primary_type#Right AST#type_annotation#Right ...
static async generateAESKey128(): Promise<string> { return CryptoUtil.generateSymKey('AES128'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AES.ets#L74-L76
ba8c20757d688ca421d885e1f6a8540721200264
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
compare
Compares the current RationalNumber object to the given object. @param { RationalNumber } another - An object of other rational numbers @returns { number } Returns 0 or 1, or -1, depending on the comparison. @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; ...
compare(another: RationalNumber): number;
AST#method_declaration#Left compare AST#parameter_list#Left ( AST#parameter#Left another : AST#type_annotation#Left AST#primary_type#Left RationalNumber AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
compare(another: RationalNumber): number;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L930-L930
2a6814f55b062a37f42225f0c39b0ffd37d92598
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/model/UserModel.ets
arkts
播放历史记录模型
export class PlayHistory { id: string; userId: number; songId: number; songTitle: string; songArtist: string; playedTime: number; constructor(userId: number, songId: number, songTitle: string, songArtist: string) { this.id = `${userId}_${songId}_${Date.now()}`; this.userId = userId; this.song...
AST#export_declaration#Left export AST#class_declaration#Left class PlayHistory AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left userId : AST#type...
export class PlayHistory { id: string; userId: number; songId: number; songTitle: string; songArtist: string; playedTime: number; constructor(userId: number, songId: number, songTitle: string, songArtist: string) { this.id = `${userId}_${songId}_${Date.now()}`; this.userId = userId; this.song...
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L99-L141
7046cd61c8fcfbf3d8c7860831c16f9c2673627d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/ContactsPage.ets
arkts
buildFilterMenu
构建筛选菜单
@Builder buildFilterMenu() { // 简化实现,实际应该是弹出菜单 Column() { Text('筛选菜单占位符') .fontSize(16) .textAlign(TextAlign.Center) .padding(20) } .width('100%') .backgroundColor('#ffffff') .onClick(() => { this.showFilterMenu = false; }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilterMenu 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#container_content_body#Le...
@Builder buildFilterMenu() { Column() { Text('筛选菜单占位符') .fontSize(16) .textAlign(TextAlign.Center) .padding(20) } .width('100%') .backgroundColor('#ffffff') .onClick(() => { this.showFilterMenu = false; }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L453-L467
61d512f5738b9e8a0714d0fa6ee69e35701321f0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/onlinesearch/OnlineWord.ets
arkts
MARK: - CodingKeys 编码键类 OnlineWord JSON 编码键定义 包含与服务器 API 交互时使用的键名
export class CodingKeys { static readonly TitleEn = 'title_en' static readonly PronEn = 'pron_en' static readonly PronUs = 'pron_us' static readonly TitleCn1 = 'title_cn1' static readonly TitleCn2 = 'title_cn2' static readonly TitleCn3 = 'title_cn3' static readonly WordChange ...
AST#export_declaration#Left export AST#class_declaration#Left class CodingKeys AST#class_body#Left { AST#property_declaration#Left static readonly TitleEn = AST#expression#Left 'title_en' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly PronEn = AST#expression#Left 'pro...
export class CodingKeys { static readonly TitleEn = 'title_en' static readonly PronEn = 'pron_en' static readonly PronUs = 'pron_us' static readonly TitleCn1 = 'title_cn1' static readonly TitleCn2 = 'title_cn2' static readonly TitleCn3 = 'title_cn3' static readonly WordChange ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/onlinesearch/OnlineWord.ets#L34-L53
d0a9e438b65138ee298e1ad9a0ec1d4dc69a7126
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookLists.ets
arkts
WorksBookLists
书单
@Component export default struct WorksBookLists { @Link checkGroup:Record<number, boolean> @Prop EXHIBIT: string @Prop currentIndex:number @Prop worksLists:WorksLists[] =[] @Prop isShowCheck:boolean = false @State worksBook:WorksLists = new WorksLists() @StorageLink('BOOK_IS_BOOK_WORKS_BOOK_LIST') @Watch(...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct WorksBookLists AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right checkGroup : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST...
@Component export default struct WorksBookLists { @Link checkGroup:Record<number, boolean> @Prop EXHIBIT: string @Prop currentIndex:number @Prop worksLists:WorksLists[] =[] @Prop isShowCheck:boolean = false @State worksBook:WorksLists = new WorksLists() @StorageLink('BOOK_IS_BOOK_WORKS_BOOK_LIST') @Watch(...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/Shelf/WorksBookLists.ets#L13-L36
b26475e0a2c1e69e590b5a5636e88e830ce88c2e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityText.ets
arkts
AccessibilityText
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...
@Component export struct AccessibilityText { @Builder customAccessibilityNode() { Column() { Text(`virtual node`) } .width(10) .height(10) } build() { NavDestination() { Row() { Column() { Text($r('app.string.UniversalAttributesAccessibility_text5')) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AccessibilityText AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right customAccessibilityNode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_functio...
@Component export struct AccessibilityText { @Builder customAccessibilityNode() { Column() { Text(`virtual node`) } .width(10) .height(10) } build() { NavDestination() { Row() { Column() { Text($r('app.string.UniversalAttributesAccessibility_text5')) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityText.ets#L16-L52
359115346bef8588a3d0afb295d782742d20b79e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/component/LoadingProgressView.ets
arkts
LoadingProgressView
TODO LoadingProgress组件 author: 桃花镇童长老ᥫ᭡ since: 2024/08/01
@Component export struct LoadingProgressView { @Prop options: LoadingProgressOptions; @State content: string = ''; aboutToAppear(): void { if (this.options.content) { this.content = Helper.getResourceStr(this.options.content) ?? ""; } } build() { Column() { Stack() { Progress...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingProgressView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right options : AST#type_annotation#Left AST#primary_type#Left LoadingProgressOptions AST#primary_typ...
@Component export struct LoadingProgressView { @Prop options: LoadingProgressOptions; @State content: string = ''; aboutToAppear(): void { if (this.options.content) { this.content = Helper.getResourceStr(this.options.content) ?? ""; } } build() { Column() { Stack() { Progress...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/component/LoadingProgressView.ets#L24-L76
751b0a0087b011892d4e6a6d268053eaef6f3305
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/AVMetadataExtractor/AVMetadataExtractorArkTS/entry/src/main/ets/pages/Index.ets
arkts
testFetchMetadataFromFdSrcByPromise
在以下demo中,使用资源管理接口获取打包在HAP内的媒体资源文件,通过设置fdSrc属性,获取音频元数据并打印。 获取音频专辑封面并通过Image控件显示在屏幕上。该demo以Promise形式进行异步接口调用。
async testFetchMetadataFromFdSrcByPromise() { if (canIUse('SystemCapability.Multimedia.Media.AVMetadataExtractor')) { try { // 创建AVMetadataExtractor对象。 let avMetadataExtractor: media.AVMetadataExtractor = await media.createAVMetadataExtractor(); // 设置fdSrc。 let context = this....
AST#method_declaration#Left async testFetchMetadataFromFdSrcByPromise AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( AST#e...
async testFetchMetadataFromFdSrcByPromise() { if (canIUse('SystemCapability.Multimedia.Media.AVMetadataExtractor')) { try { let avMetadataExtractor: media.AVMetadataExtractor = await media.createAVMetadataExtractor(); let context = this.getUIContext().getHostContext() as com...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVMetadataExtractor/AVMetadataExtractorArkTS/entry/src/main/ets/pages/Index.ets#L113-L137
71f548cb42bd8707745a3d574132332d70e04710
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
礼物统计接口
export interface GiftStats { totalRecommended: number; totalSaved: number; averageSuitability: number; mostRecommendedType: GiftType; typeDistribution: Record<GiftType, number>; priceRangeDistribution: Record<PriceRange, number>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GiftStats AST#object_type#Left { AST#type_member#Left totalRecommended : 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 totalSaved : AST#type_a...
export interface GiftStats { totalRecommended: number; totalSaved: number; averageSuitability: number; mostRecommendedType: GiftType; typeDistribution: Record<GiftType, number>; priceRangeDistribution: Record<PriceRange, number>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L628-L635
3a742f5fde56a8b678d5df09924ded09aeaf6be9
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhForm/JhSetCell.ets
arkts
JhSetCell
底部线高
@Preview @Component export struct JhSetCell { @Prop public leftIcon?: ResourceStr = '' // 左侧图标,不设置时不显示 eg: $rawfile("svg/ic_login_user.svg") @BuilderParam leftWidget?: () => void // 左侧自定义组件,默认隐藏,优先级高于leftIcon @Prop public title: ResourceStr = '' // 左侧标题 @Prop public titleWidth: number = _titleWidth // 标题宽度 @P...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct JhSetCell AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right public leftIcon ? : AST#type_annotation#Left AST#primary...
@Preview @Component export struct JhSetCell { @Prop public leftIcon?: ResourceStr = '' @BuilderParam leftWidget?: () => void @Prop public title: ResourceStr = '' @Prop public titleWidth: number = _titleWidth @Prop public titleStyle: TextStyle = { fontSize: _titleFontSize, fontColor: _titleColor } @Prop ...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhForm/JhSetCell.ets#L26-L140
57954652ac2abc76fdb1c14ae9180aa775ce6678
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/AddBill.ets
arkts
KeyboardArea
金额输入和数字键盘区域
@Builder KeyboardArea() { Column() { // 金额显示区域 Column() { Text(this.amount || '0') .fontSize(60) .fontColor('#333333') .fontWeight(FontWeight.Medium) .width('100%') .textAlign(TextAlign.End) .padding({ right: 20, top: 20, bottom: 20 }...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right KeyboardArea 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#container_content_body#Left { // 金额显示区域 AST#ar...
@Builder KeyboardArea() { Column() { Column() { Text(this.amount || '0') .fontSize(60) .fontColor('#333333') .fontWeight(FontWeight.Medium) .width('100%') .textAlign(TextAlign.End) .padding({ right: 20, top: 20, bottom: 20 }) }...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddBill.ets#L233-L304
db1bbd8a905a93eb36021120bd48fa8e7cc7e7f3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets
arkts
task info on selected day
constructor(currentDate: Date) { this.currentDate = currentDate; this.showDate = currentDate.getTime(); this.dateTitle = weekDateFormat(currentDate.getTime()); this.selectedDay = (new Date().getDay() + WEEK_DAY_NUM - 1) % WEEK_DAY_NUM; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left currentDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_stateme...
constructor(currentDate: Date) { this.currentDate = currentDate; this.showDate = currentDate.getTime(); this.dateTitle = weekDateFormat(currentDate.getTime()); this.selectedDay = (new Date().getDay() + WEEK_DAY_NUM - 1) % WEEK_DAY_NUM; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/HomeViewModel.ets#L41-L46
f5387b7b9172fcedfe7d889ae679c004049cbab6
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
onSideBarSelected
处理侧边栏选中事件 @param {number} index - 目标索引 @returns {number} 实际滚动目标索引
onSideBarSelected(index: number): number { const targetIndex: number = this.clampIndex(index); this.isSideBarScrolling = true; this.selectedCategoryIndex = targetIndex; this.startSideBarUnlockTimer(targetIndex); return targetIndex; }
AST#method_declaration#Left onSideBarSelected 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 number AST#primary_typ...
onSideBarSelected(index: number): number { const targetIndex: number = this.clampIndex(index); this.isSideBarScrolling = true; this.selectedCategoryIndex = targetIndex; this.startSideBarUnlockTimer(targetIndex); return targetIndex; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L80-L86
4b9d54413126ac095a46e4faffa3787c44423ffe
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/hapA/src/main/ets/pages/HapPageOne.ets
arkts
HapPageOne
@Route({name: RouterConstants.HAP_A_PAGE_ONE})
@Route({name: RouterMap.HapA.HAP_A_PAGE_ONE}) @Component export struct HapPageOne { build() { NavDestination(){ Column({ space: 15 }) { Text("hello, world!") } } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterMap ...
@Route({name: RouterMap.HapA.HAP_A_PAGE_ONE}) @Component export struct HapPageOne { build() { NavDestination(){ Column({ space: 15 }) { Text("hello, world!") } } } }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/hapA/src/main/ets/pages/HapPageOne.ets#L5-L15
d5e8c277ab9cb0d6fa987eb37f2bd0771c45cc6a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fadingedge/Index.ets
arkts
FadingEdgeComponent
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 { FadingEdgeComponent } from "./src/main/ets/mainpage/MainPage";
AST#export_declaration#Left export { FadingEdgeComponent } from "./src/main/ets/mainpage/MainPage" ; AST#export_declaration#Right
export { FadingEdgeComponent } from "./src/main/ets/mainpage/MainPage";
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fadingedge/Index.ets#L15-L15
b06eb34cc844c832d1f0f0c7acc7c9bbfe2b9ec8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
getConfig
获取本地化配置
getConfig(): LocaleConfig { return { ...this.config }; }
AST#method_declaration#Left getConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LocaleConfig AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#...
getConfig(): LocaleConfig { return { ...this.config }; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L467-L469
36c4e0d282c9cfaaa67ac911cbcb0f4f79f3b286
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
getOverviewStats
获取总览统计
async getOverviewStats(): Promise<OverviewStats> { const contactSearchParams: ContactSearchParams = { pageSize: 10000 }; const greetingSearchParams: GreetingSearchParams = { pageSize: 10000 }; const contacts = await this.contactService.searchContacts(contactSearchParams); const greetings = await th...
AST#method_declaration#Left async getOverviewStats 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 OverviewStats AST#primary_type#Right AST#type_annotation#Right >...
async getOverviewStats(): Promise<OverviewStats> { const contactSearchParams: ContactSearchParams = { pageSize: 10000 }; const greetingSearchParams: GreetingSearchParams = { pageSize: 10000 }; const contacts = await this.contactService.searchContacts(contactSearchParams); const greetings = await th...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L376-L423
25498072851faa5f4dc0fda041124b60c8d9db58
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/state/BaseNetWorkUiState.ets
arkts
网络请求 UI 状态枚举 @author Joker.X
export enum BaseNetWorkUiState { /** * 加载中 */ LOADING = "loading", /** * 请求成功 */ SUCCESS = "success", /** * 请求失败 */ ERROR = "error" }
AST#export_declaration#Left export AST#enum_declaration#Left enum BaseNetWorkUiState AST#enum_body#Left { /** * 加载中 */ AST#enum_member#Left LOADING = AST#expression#Left "loading" AST#expression#Right AST#enum_member#Right , /** * 请求成功 */ AST#enum_member#Left SUCCESS = AST#expression#Left "success" AST#expr...
export enum BaseNetWorkUiState { LOADING = "loading", SUCCESS = "success", ERROR = "error" }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/state/BaseNetWorkUiState.ets#L5-L18
459438f0d5d44fefe962e4c235f4e109b79f5e9c
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets
arkts
unregisterSessionListener
[End update_is_play] [Start init_session]
async unregisterSessionListener(): Promise<void> { // [StartExclude init_session] if (!this.avSession) { return; } try { this.avSession.off('play'); this.avSession.off('pause'); this.avSession.off('playNext'); this.avSession.off('playPrevious'); this.avSession.off('se...
AST#method_declaration#Left async unregisterSessionListener 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 >...
async unregisterSessionListener(): Promise<void> { if (!this.avSession) { return; } try { this.avSession.off('play'); this.avSession.off('pause'); this.avSession.off('playNext'); this.avSession.off('playPrevious'); this.avSession.off('setLoopMode'); this.avSess...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets#L162-L181
bf2e8b60215ad01bfc6f409e4d44ac8371e44ef3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
数据库服务统一管理类 提供所有数据库操作的统一接口
export class DatabaseService { private static instance: DatabaseService; private dbManager: DatabaseManager; private contactDAO: ContactDAO; private commemorationDAO: CommemorationDAO; private greetingHistoryDAO: GreetingHistoryDAO; private isInitialized: boolean = false; private constructor() { this...
AST#export_declaration#Left export AST#class_declaration#Left class DatabaseService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left DatabaseService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_...
export class DatabaseService { private static instance: DatabaseService; private dbManager: DatabaseManager; private contactDAO: ContactDAO; private commemorationDAO: CommemorationDAO; private greetingHistoryDAO: GreetingHistoryDAO; private isInitialized: boolean = false; private constructor() { this...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L21-L668
9605d1fa4a7a808490050c42f252cd1e84a6b24e
github
Delsin-Yu/JustPDF.git
d53f566e02820dac46e1752151750144acbed50a
entry/src/main/ets/components/PageInfo.ets
arkts
evictViewerCache
Evicts all viewer caches, releasing PixelMaps and cancelling pending tasks. Used to free memory for pages that are far from the current view.
public evictViewerCache(): void { // Release all cached PixelMaps for (const cache of this.caches.values()) { try { cache.pixelMap.release(); } catch (error) { hilog.warn(0, 'PDFView', `释放 PixelMap 时出错: ${error}`); } } this.caches.clear(); // Cancel pending cac...
AST#method_declaration#Left public evictViewerCache 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 { // Release all cached PixelMaps AST#statement#Left AST#for_statement#Left for ( const...
public evictViewerCache(): void { for (const cache of this.caches.values()) { try { cache.pixelMap.release(); } catch (error) { hilog.warn(0, 'PDFView', `释放 PixelMap 时出错: ${error}`); } } this.caches.clear(); this.cancelPendingTasks(); hilog.warn(...
https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L208-L223
ddeb60db94f21096c7bde7875a4b85c67c72a314
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets
arkts
默认图片Referer
export const DEFAULT_REFER: string = 'https://gitee.com/';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DEFAULT_REFER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'https://gitee.com/' AST#expression#Right AST#variable_declarator#Right ; AST#v...
export const DEFAULT_REFER: string = 'https://gitee.com/';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets#L20-L20
b0dec245fb2b03b88f2fa80834ec2e65f80d75de
gitee
TianQvQ/WeChat_ArkTs.git
077ddcdb8e8032f71f45540461fbd66f2d49c973
entry/src/main/ets/Toptag/StatusBarManager.ets
arkts
immerseFullScreenAsync
沉浸式全屏(全屏屏幕,且显示状态栏、导航栏) 异步方法:适合动态监听状态栏,导航栏并做相应调整的方式。这种方案比较麻烦,但是用户体验和性能更好。 仅在Ability使用(Ability全局,且初始化状态栏和导航栏的高度),建议在 Ability --> onWindowStageCreate 中执行
static async immerseFullScreenAsync(windowStage: window.WindowStage) { let windowClass: window.Window = await windowStage.getMainWindow() // 获取状态栏和导航栏的高度 windowClass.on("avoidAreaChange", ({ type, area }) => { if (type == window.AvoidAreaType.TYPE_SYSTEM) { // 将状态栏和导航栏的高度保存在AppStorage中 ...
AST#method_declaration#Left static async immerseFullScreenAsync 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#param...
static async immerseFullScreenAsync(windowStage: window.WindowStage) { let windowClass: window.Window = await windowStage.getMainWindow() windowClass.on("avoidAreaChange", ({ type, area }) => { if (type == window.AvoidAreaType.TYPE_SYSTEM) { AppStorage.SetOrCreate<number>(STATUS_BAR_...
https://github.com/TianQvQ/WeChat_ArkTs.git/blob/077ddcdb8e8032f71f45540461fbd66f2d49c973/entry/src/main/ets/Toptag/StatusBarManager.ets#L33-L41
6d9a44da10e1dba13b451956d71ccfe51f83452a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_encryption_decryption/sm4_gcm_encryption_decryption_asynchronous.ets
arkts
decryptMessagePromise
解密消息
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams); let decryptUpdate = await decoder.update(cipherText); // g...
AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par...
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams); let decryptUpdate = await decoder.update(cipherText); l...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_encryption_decryption/sm4_gcm_encryption_decryption_asynchronous.ets#L59-L69
2c8287c93aac99c90bc3d4d29f64750caa8ed16e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/Index.ets
arkts
VideoLinkageListView
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 { VideoLinkageListView } from './src/main/ets/pages/VideoLinkageList'
AST#export_declaration#Left export { VideoLinkageListView } from './src/main/ets/pages/VideoLinkageList' AST#export_declaration#Right
export { VideoLinkageListView } from './src/main/ets/pages/VideoLinkageList'
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/Index.ets#L15-L15
c50d0994b6c083efcc75d3bec21c340a247d07d5
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/component/index/AppsTableComponent.ets
arkts
AppsTableComponent
AppsTableComponent.ets
@Component export struct AppsTableComponent { currentPage: number = 1; searchKeyword: string = ""; searchKey: string = "name"; excludeHuawei: boolean = false; excludeAtomic: boolean = false; searchExact: boolean = false; @State appList: Array<AppItem> = []; @State isLoading: boolean = t...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AppsTableComponent AST#component_body#Left { AST#property_declaration#Left currentPage : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 A...
@Component export struct AppsTableComponent { currentPage: number = 1; searchKeyword: string = ""; searchKey: string = "name"; excludeHuawei: boolean = false; excludeAtomic: boolean = false; searchExact: boolean = false; @State appList: Array<AppItem> = []; @State isLoading: boolean = t...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/component/index/AppsTableComponent.ets#L2-L124
3247c25de4ba0b18cbdd46b749f82fd2380299a8
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets
arkts
confirm
确认按钮 @param confirm @returns
confirm(confirm: ButtonOptions) { this.builderOptions.confirm = confirm return this; }
AST#method_declaration#Left confirm AST#parameter_list#Left ( AST#parameter#Left confirm : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#L...
confirm(confirm: ButtonOptions) { this.builderOptions.confirm = confirm return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets#L46-L49
0dbeef88f298ac80c0aa3c300ea73d9fd1d71de0
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/NumberMenu.ets
arkts
NumberMenu
数字键盘
@Component export struct NumberMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; private numberList: sourceListType[] = numberSourceListData; private spaceWidth: Resource = this.inputStyle.spaceButtonWidth_2; private returnWidth: Resou...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NumberMenu AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Left A...
@Component export struct NumberMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; private numberList: sourceListType[] = numberSourceListData; private spaceWidth: Resource = this.inputStyle.spaceButtonWidth_2; private returnWidth: Resou...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/NumberMenu.ets#L25-L82
e36e97b36a65858aa581c07c036769862dc2c3bc
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
entry/src/main/ets/pages/Model/TaskStore.ets
arkts
init
必须在应用启动时调用一次 例如在 EntryAbility.onCreate 里: await taskStore.init(this.context);
public async init(context: common.UIAbilityContext) { this.context = context; this.pref = await dataPreferences.getPreferences(context, TaskStore.PREF_NAME); await this.loadFromDisk(); }
AST#method_declaration#Left public async init 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...
public async init(context: common.UIAbilityContext) { this.context = context; this.pref = await dataPreferences.getPreferences(context, TaskStore.PREF_NAME); await this.loadFromDisk(); }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/pages/Model/TaskStore.ets#L18-L22
68f0c549bbafa1f03c279ecf9393854a34085840
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ResourceAllocation/ApplicationThemeSwitch/entry/src/main/ets/models/ThemeConst.ets
arkts
DEFAULT_COLOR 默认字体颜色 BACKGROUND_COLOR 默认背景色 TITLE_BACKGROUND title背景色 STATUS_COLOR 状态栏字体颜色 CATEGORIES_BACKGROUND_COLOR title下边的导航字体颜色 nav_* 导航图片 NAV_SELECTED_COLOR 导航选中字体颜色 MAIN_BACKGROUND_COLOR 主体背景色 自定义主题
export class CustomTheme { static DEFAULT_COLOR = $r('app.color.white') static BACKGROUND_COLOR = $r('app.color.custom_main_color') static TITLE_BACKGROUND = $r('app.color.custom_main_color') static STATUS_COLOR = $r('app.color.custom_status_color') static CATEGORIES_BACKGROUND_COLOR = $r('app.color.custom_ma...
AST#export_declaration#Left export AST#class_declaration#Left class CustomTheme AST#class_body#Left { AST#property_declaration#Left static DEFAULT_COLOR = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right...
export class CustomTheme { static DEFAULT_COLOR = $r('app.color.white') static BACKGROUND_COLOR = $r('app.color.custom_main_color') static TITLE_BACKGROUND = $r('app.color.custom_main_color') static STATUS_COLOR = $r('app.color.custom_status_color') static CATEGORIES_BACKGROUND_COLOR = $r('app.color.custom_ma...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ResourceAllocation/ApplicationThemeSwitch/entry/src/main/ets/models/ThemeConst.ets#L25-L37
eda82c499b08fe972cdde9f7634dc77148701ca8
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/VerifyPage.ets
arkts
updateVerifyItem
更新验证码显示项
updateVerifyItem() { let verifyItemNew: VerifyItem | undefined = this.verifyMap.get(this.imageId); if (verifyItemNew !== undefined) { this.verifyItem = verifyItemNew; } }
AST#method_declaration#Left updateVerifyItem AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left verifyItemNew : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left VerifyItem AST#primary_type#Ri...
updateVerifyItem() { let verifyItemNew: VerifyItem | undefined = this.verifyMap.get(this.imageId); if (verifyItemNew !== undefined) { this.verifyItem = verifyItemNew; } }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/VerifyPage.ets#L57-L62
c5060f9b7b5511ea1099c8952359fdaacf4f7534
github
sedlei/Smart-park-system.git
253228f73e419e92fd83777f564889d202f7c699
src/main/ets/utils/MqttUtil.ets
arkts
loadConfigs
加载配置文件
private async loadConfigs(): Promise<void> { // 读取配置文件数据 let context = getContext(this); const mqttConfigData: Uint8Array = await context.resourceManager.getRawFileContent('MqttConfig.json'); // 数据转换为文本 const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); const mqttConfigText =...
AST#method_declaration#Left private async loadConfigs 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#t...
private async loadConfigs(): Promise<void> { let context = getContext(this); const mqttConfigData: Uint8Array = await context.resourceManager.getRawFileContent('MqttConfig.json'); const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); const mqttConfigText = decoder.decodeWithSt...
https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/MqttUtil.ets#L39-L63
c89ab93a2cd16d93b478757ee1e4e44cf4edb1f7
github
ChangweiZhang/chardet-arkts.git
3a214882ec6a2753c0fed84162952aa659341c19
src/main/ets/components/encoding/mbcs.ets
arkts
The charset recognize for EUC-KR. A singleton instance of this class is created and kept by the public CharsetDetector class
export class euc_kr extends mbcs { name() { return 'EUC-KR'; } language() { return 'ko'; } // TODO: This set of data comes from the character frequency- // of-occurrence analysis tool. The data needs to be moved // into a resource and loaded from there. commonChars = [ 0xb0...
AST#export_declaration#Left export AST#class_declaration#Left class euc_kr extends AST#type_annotation#Left AST#primary_type#Left mbcs AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left name AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { A...
export class euc_kr extends mbcs { name() { return 'EUC-KR'; } language() { return 'ko'; } commonChars = [ 0xb0a1, 0xb0b3, 0xb0c5, 0xb0cd, 0xb0d4, 0xb0e6, 0xb0ed, 0xb0f8, 0xb0fa, 0xb0fc, 0xb1b8, 0xb1b9, 0xb1c7, 0xb1d7, 0xb1e2, 0xb3aa, 0xb3bb, 0xb4c2, 0xb4cf, 0xb4d9, 0xb4eb, 0xb5...
https://github.com/ChangweiZhang/chardet-arkts.git/blob/3a214882ec6a2753c0fed84162952aa659341c19/src/main/ets/components/encoding/mbcs.ets#L396-L424
dbebe8ca1e6d442df0e1445d79020c1a49ca432d
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/FeedbackSubmitRequest.ets
arkts
@file 提交意见反馈请求模型 @author Joker.X
export class FeedbackSubmitRequest { /** * 联系方式 */ contact?: string | null; /** * 类型 */ type: number; /** * 内容 */ content: string; /** * 图片 */ images?: string[] | null; /** * @param {FeedbackSubmitRequest} init - 初始化数据 */ constructor(init: FeedbackSubmitRequest) { ...
AST#export_declaration#Left export AST#class_declaration#Left class FeedbackSubmitRequest AST#class_body#Left { /** * 联系方式 */ AST#property_declaration#Left contact ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Rig...
export class FeedbackSubmitRequest { contact?: string | null; type: number; content: string; images?: string[] | null; constructor(init: FeedbackSubmitRequest) { this.type = init.type; this.content = init.content; if (init.contact !== undefined) { this.contact = init.contact;...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/FeedbackSubmitRequest.ets#L5-L36
12380eee9c8c53ec556ccd57dc8c84de2d2521a3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/Index.ets
arkts
DetailPage
Copyright (c) 2022-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,...
export { DetailPage } from './src/main/ets/main/DetailPage';
AST#export_declaration#Left export { DetailPage } from './src/main/ets/main/DetailPage' ; AST#export_declaration#Right
export { DetailPage } from './src/main/ets/main/DetailPage';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/Index.ets#L17-L17
7071093ffa93c33265a0484d0cdce937d900e87f
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
getRemainingDays
获取剩余天数
getRemainingDays(): number { if (!this.expiryDate) return -1; const expiryTime = new Date(this.expiryDate).getTime(); const now = new Date().getTime(); const diffTime = expiryTime - now; return Math.ceil(diffTime / (1000 * 60 * 60 * 24)); }
AST#method_declaration#Left getRemainingDays 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Le...
getRemainingDays(): number { if (!this.expiryDate) return -1; const expiryTime = new Date(this.expiryDate).getTime(); const now = new Date().getTime(); const diffTime = expiryTime - now; return Math.ceil(diffTime / (1000 * 60 * 60 * 24)); }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L215-L221
38987dde2db622b94d7c615900ea9c74e7d39575
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/base/HmDialogOptions.ets
arkts
TODO 确认弹出框,Base参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export interface HmDialogOptions extends DialogOptions { content?: ResourceStr; //弹框内容。 primaryButton?: ButtonOptions | ResourceStr; //弹框左侧按钮。 secondaryButton?: ButtonOptions | ResourceStr; //弹框右侧按钮。 onAction: ActionCallBack; //按钮的CallBack事件。 }
AST#export_declaration#Left export AST#interface_declaration#Left interface HmDialogOptions AST#extends_clause#Left extends DialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left content ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation...
export interface HmDialogOptions extends DialogOptions { content?: ResourceStr; primaryButton?: ButtonOptions | ResourceStr; secondaryButton?: ButtonOptions | ResourceStr; onAction: ActionCallBack; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/base/HmDialogOptions.ets#L25-L32
8a03ce3da7dcb8042f6283b5ceae2ece7ece8000
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
syncRotationAngle
Sync rotate angle. @param angle
syncRotationAngle(angle: number) { this.rotationAngle = angle; MathUtils.swapWidthHeight(this.cropRect); this.swapCurrentRatio(); this.enlargeCropArea(); }
AST#method_declaration#Left syncRotationAngle AST#parameter_list#Left ( AST#parameter#Left angle : 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#expression_statement#Left AST#expr...
syncRotationAngle(angle: number) { this.rotationAngle = angle; MathUtils.swapWidthHeight(this.cropRect); this.swapCurrentRatio(); this.enlargeCropArea(); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L122-L127
a8be5c103684c07469f9395186cf26d198da582d
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
arkts
getNode
Retrieve sub components based on type, reuse them directly if available, and create new sub components if not available
public getNode(type: string, item: ESObject, itemColor: Color, builder: WrappedBuilder<ESObject>): NodeItem | undefined { let nodeItem: NodeItem | undefined = this.nodePool.get(type)?.pop(); if (!nodeItem) { nodeItem = new NodeItem(); nodeItem.builder = builder; nodeItem.data.data = item; ...
AST#method_declaration#Left public getNode AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#R...
public getNode(type: string, item: ESObject, itemColor: Color, builder: WrappedBuilder<ESObject>): NodeItem | undefined { let nodeItem: NodeItem | undefined = this.nodePool.get(type)?.pop(); if (!nodeItem) { nodeItem = new NodeItem(); nodeItem.builder = builder; nodeItem.data.data = item; ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L89-L103
761615bca9e877c3caf2d4364cda77c15b1b0f53
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/views/Home/HomeCategory.ets
arkts
textTitle
只支持全局
@Extend(Text) function textTitle() { .fontSize(14) .fontWeight(500) .fontColor($r('app.color.black')) .width('100%') .margin({ top: 20 }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function textTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#exp...
@Extend(Text) function textTitle() { .fontSize(14) .fontWeight(500) .fontColor($r('app.color.black')) .width('100%') .margin({ top: 20 }) }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/views/Home/HomeCategory.ets#L9-L16
9eea4ab1c57677cb23dcade2b6e95c100af6719a
github
xsdkhlgz/ATSOBJECT_OF_FIRST.git
8c14e875d7ec3f418bb7cdaae123a8fea87a7e76
entry/src/main/ets/view/record/DatePickDialog.ets
arkts
DatePickDialog
不是component ,吃了大亏,一定要再仔细一点,但有一点不明白的就是将CustomDialog 替换成component就会报错到底是什么原因
@CustomDialog export default struct DatePickDialog { //对话框的开发不能漏掉下面这句 controller: CustomDialogController selectedDate: Date = new Date() build() { Column({ space: 12 }) { //1.日期选择器 DatePicker({ start: new Date('2020-01-01'), end: new Date('2100-01-01'), selected: this.se...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct DatePickDialog AST#component_body#Left { //对话框的开发不能漏掉下面这句 AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_ann...
@CustomDialog export default struct DatePickDialog { controller: CustomDialogController selectedDate: Date = new Date() build() { Column({ space: 12 }) { DatePicker({ start: new Date('2020-01-01'), end: new Date('2100-01-01'), selected: this.selectedDate }) ...
https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/view/record/DatePickDialog.ets#L4-L56
ad23e0f03d895404d45192691a5ed4d9b373eadc
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/A1Z26Cipher.ets
arkts
A1Z26密码实现 A1Z26密码是一种简单的替换密码,将字母A-Z替换为数字1-26
export class A1Z26Cipher { /** * 将文本转换为数字序列 * @param text 要加密的文本 * @param separator 数字之间的分隔符 * @returns 加密后的数字序列 */ static encrypt(text: string, separator: string = '-'): string { if (!text) { return ''; } return text.toUpperCase().split('').map(char => { if (char >= 'A' && c...
AST#export_declaration#Left export AST#class_declaration#Left class A1Z26Cipher AST#class_body#Left { /** * 将文本转换为数字序列 * @param text 要加密的文本 * @param separator 数字之间的分隔符 * @returns 加密后的数字序列 */ AST#method_declaration#Left static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation...
export class A1Z26Cipher { static encrypt(text: string, separator: string = '-'): string { if (!text) { return ''; } return text.toUpperCase().split('').map(char => { if (char >= 'A' && char <= 'Z') { return (char.charCodeAt(0) - 64).toString(); } return char; }).jo...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/A1Z26Cipher.ets#L5-L44
350dbf9f3e30c250959b2fdef78c3d526ea57f95
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/login/LogOffView.ets
arkts
confirmLogoff
确认退出登录
confirmLogoff(){ Toast.showAlert({ title: $r('app.string.alert_title_confirm'),//退出登录 message: $r('app.string.logoff_msg_logoff'), secondaryButton: {value: $r('app.string.cfm_btn_cancel'), fontColor: Color.Gray, action: () => {}}, primaryButton: {value: $r('app.string.logoff_cfm_yes'), actio...
AST#method_declaration#Left confirmLogoff 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 Toast AST#expression#Right . showAlert AST#member_...
confirmLogoff(){ Toast.showAlert({ title: $r('app.string.alert_title_confirm'), message: $r('app.string.logoff_msg_logoff'), secondaryButton: {value: $r('app.string.cfm_btn_cancel'), fontColor: Color.Gray, action: () => {}}, primaryButton: {value: $r('app.string.logoff_cfm_yes'), action: () ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/LogOffView.ets#L109-L120
779d087218b8bf55bc327bff761c5454d461de8b
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/ThemeManager.ets
arkts
getDefaultTheme
获取默认主题
private getDefaultTheme(): ThemeModel { return { type: 'minimal', name: '简约主题', description: '简洁清爽,专注内容', colors: { primaryColor: '#00C851', primaryLightColor: '#4DD776', secondaryColor: '#FFD700', backgroundColor: '#F8F9FA', surfaceColor: '#FFFFFF', ...
AST#method_declaration#Left private getDefaultTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ThemeModel AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#obj...
private getDefaultTheme(): ThemeModel { return { type: 'minimal', name: '简约主题', description: '简洁清爽,专注内容', colors: { primaryColor: '#00C851', primaryLightColor: '#4DD776', secondaryColor: '#FFD700', backgroundColor: '#F8F9FA', surfaceColor: '#FFFFFF', ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L52-L72
281199276e87d8cab51ae7ae29a55038e9e92e56
github
ikunbranch666-auto/SimpleCalculator.git
ea24568014d05285ad3def5b741380294308aef2
entry/src/main/ets/model/ImageList.ets
arkts
垂直方向的按钮(右侧操作符 - 第5列)
export function obtainImgV(): ImageList[] { return [ { image: '', value: '+' // 第1行第5列 }, { image: '', value: '-' // 第2行第5列 }, { image: '', value: '=' // 第3行第5列(占两行) } ] }
AST#export_declaration#Left export AST#function_declaration#Left function obtainImgV AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ImageList [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AS...
export function obtainImgV(): ImageList[] { return [ { image: '', value: '+' }, { image: '', value: '-' }, { image: '', value: '=' } ] }
https://github.com/ikunbranch666-auto/SimpleCalculator.git/blob/ea24568014d05285ad3def5b741380294308aef2/entry/src/main/ets/model/ImageList.ets#L22-L37
4959dad86dc752791fa222f896d8204f5e3f5f3b
github
charon2pluto/MoodDiary-HarmonyOS.git
0ec7ee6861e150bc9b4571062dbf302d1b106b8c
entry/src/main/ets/pages/SettingsPage.ets
arkts
handleClearData
处理清空数据的逻辑
handleClearData() { AlertDialog.show({ title: '⚠️ 危险操作', message: '确定要删除所有的心情日记吗?删除后无法恢复!', autoCancel: true, alignment: DialogAlignment.Bottom, offset: { dx: 0, dy: -20 }, primaryButton: { value: '取消', action: () => {} }, secondaryButton: { va...
AST#method_declaration#Left handleClearData 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 AlertDialog AST#expression#Right . show AST#memb...
handleClearData() { AlertDialog.show({ title: '⚠️ 危险操作', message: '确定要删除所有的心情日记吗?删除后无法恢复!', autoCancel: true, alignment: DialogAlignment.Bottom, offset: { dx: 0, dy: -20 }, primaryButton: { value: '取消', action: () => {} }, secondaryButton: { va...
https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/pages/SettingsPage.ets#L120-L141
6e80697480a8c708026107b7d717d3e66e2e6a7a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SavePictureFromWeb.ets
arkts
saveImage
将沙箱路径下的图片写入到相册 @param srcFileUris 图片的沙箱路径
async saveImage(srcFileUris: Array<string>) { let phAccessHelper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(this.context); try { let photoCreationConfigs: Array<photoAccessHelper.PhotoCreationConfig> = [ { title: 'savePictureFromWeb', fileNam...
AST#method_declaration#Left async saveImage AST#parameter_list#Left ( AST#parameter#Left srcFileUris : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async saveImage(srcFileUris: Array<string>) { let phAccessHelper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(this.context); try { let photoCreationConfigs: Array<photoAccessHelper.PhotoCreationConfig> = [ { title: 'savePictureFromWeb', fileNam...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SavePictureFromWeb.ets#L73-L124
2793df3e90b80e0f7dfe5b09bc85817763932903
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
log
日志打印 @param msg
static log(msg: string): void { if (ArkWebHelper.debug) { switch (ArkWebHelper.level) { case hilog.LogLevel.DEBUG: hilog.debug(0x0001, ArkWebHelper.tag, msg); break case hilog.LogLevel.INFO: hilog.info(0x0001, ArkWebHelper.tag, msg);
AST#method_declaration#Left static log AST#parameter_list#Left ( AST#parameter#Left msg : 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#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
static log(msg: string): void { if (ArkWebHelper.debug) { switch (ArkWebHelper.level) { case hilog.LogLevel.DEBUG: hilog.debug(0x0001, ArkWebHelper.tag, msg); break case hilog.LogLevel.INFO: hilog.info(0x0001, ArkWebHelper.tag, msg);
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L411-L418
9452d9b8106d61b26d7a09a22e6e22e6e200ace5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/image/MediumAvatar.ets
arkts
MediumAvatar
@file 中等尺寸头像组件 @author Joker.X
@ComponentV2 export struct MediumAvatar { /** * 头像地址 */ @Param src: ResourceStr | PixelMap | DrawableDescriptor = ""; /** * 点击回调 */ @Param onTap: (() => void) | undefined = undefined; /** * 构建中等尺寸头像 * @returns {void} 无返回值 */ build(): void { Avatar({ src: this.src, a...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MediumAvatar AST#component_body#Left { /** * 头像地址 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resour...
@ComponentV2 export struct MediumAvatar { @Param src: ResourceStr | PixelMap | DrawableDescriptor = ""; @Param onTap: (() => void) | undefined = undefined; build(): void { Avatar({ src: this.src, avatarSize: 48, onTap: this.onTap }); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/MediumAvatar.ets#L7-L31
57bf26eb15cf7b51170d101a81111deef8b95603
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets
arkts
BottomBar
自定义封装底部bar组件
@Component export struct BottomBar { @State buttonModifier: AttributeModifier<ButtonAttribute> = new ButtonModifier(); @State barModifier: AttributeModifier<RowAttribute> = new BarModifier(); @State buttonName: Resource = $r('app.string.dynamicattributes_settlement'); @State barType: BarType = BarType.SHOPPING_...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BottomBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right buttonModifier : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier ...
@Component export struct BottomBar { @State buttonModifier: AttributeModifier<ButtonAttribute> = new ButtonModifier(); @State barModifier: AttributeModifier<RowAttribute> = new BarModifier(); @State buttonName: Resource = $r('app.string.dynamicattributes_settlement'); @State barType: BarType = BarType.SHOPPING_...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets#L44-L72
13383658e6d1b15edb495b21b825aa2a81dca247
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/model/UserModel.ets
arkts
用户数据JSON类型
export interface UserJsonData { id: number; username: string; password: string; like?: string; history?: string; phone?: number; createdTime?: number; lastLoginTime?: number; avatar?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserJsonData 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 username : AST#type_annotation#Lef...
export interface UserJsonData { id: number; username: string; password: string; like?: string; history?: string; phone?: number; createdTime?: number; lastLoginTime?: number; avatar?: string; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L4-L14
caab4437296a468daf027829d647cb2a5e7b809c
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/Channel.ets
arkts
delete
应用约束10: 使用具体返回类型
delete(): Promise<Channel> { return this.client.rest.methods.deleteChannel(this); }
AST#method_declaration#Left delete 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 Channel AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Ri...
delete(): Promise<Channel> { return this.client.rest.methods.deleteChannel(this); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/Channel.ets#L34-L36
bd627488c23117da1f17b88d376808f830427f84
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
setAvoidFirstLastClipping
if set to true, the chart will avoid that the first and last label entry in the chart "clip" off the edge of the chart or the screen @param enabled
public setAvoidFirstLastClipping(enabled: boolean): void { this.mAvoidFirstLastClipping = enabled; }
AST#method_declaration#Left public setAvoidFirstLastClipping AST#parameter_list#Left ( AST#parameter#Left enabled : 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#type_annotation#Left AST#primary_type#Left void...
public setAvoidFirstLastClipping(enabled: boolean): void { this.mAvoidFirstLastClipping = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L138-L140
99223a66d7457b96891860e3e7b6714dc6bb51d2
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/NetworkRequestViewModel.ets
arkts
requestGoodsList
发起 POST 请求(商品列表)
requestGoodsList() { const params: GoodsSearchRequest = new GoodsSearchRequest(); params.page = 1; params.size = 20; RequestHelper.repository<NetworkPageData<Goods>>(this.repository.getGoodsPage(params)) .start((): void => { this.postLoading = true; }) .execute() .then(()...
AST#method_declaration#Left requestGoodsList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsSearchRequest AST#primary_type#Right AST#type_anno...
requestGoodsList() { const params: GoodsSearchRequest = new GoodsSearchRequest(); params.page = 1; params.size = 20; RequestHelper.repository<NetworkPageData<Goods>>(this.repository.getGoodsPage(params)) .start((): void => { this.postLoading = true; }) .execute() .then(()...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/NetworkRequestViewModel.ets#L49-L64
184c49bc252dc62eff42392d270a4fa62579676c
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/types/SwipeCardTypes.ets
arkts
滑动事件处理器接口
export interface SwipeEventHandler { /** * 卡片滑动回调 */ onCardSwiped?: OnCardSwipedCallback; /** * 卡片点击回调 */ onCardClicked?: OnCardClickedCallback; /** * 卡片栈即将为空回调 */ onStackNearEmpty?: OnStackNearEmptyCallback; /** * 卡片栈为空回调 */ onStackEmpty?: OnStackEmptyCallback; /** * 预加...
AST#export_declaration#Left export AST#interface_declaration#Left interface SwipeEventHandler AST#object_type#Left { /** * 卡片滑动回调 */ AST#type_member#Left onCardSwiped ? : AST#type_annotation#Left AST#primary_type#Left OnCardSwipedCallback AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /*...
export interface SwipeEventHandler { onCardSwiped?: OnCardSwipedCallback; onCardClicked?: OnCardClickedCallback; onStackNearEmpty?: OnStackNearEmptyCallback; onStackEmpty?: OnStackEmptyCallback; onLoadNextPage?: OnLoadNextPageCallback; }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L80-L105
1f9a738741420778e3bb26bfee982f9d0b721a65
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bigfilecopy/src/main/ets/constants/BigFileCopyConstants.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 BigFileCopyConstants { static readonly PROGRESS_MAX: number = 100; static readonly PROGRESS_MIN: number = 0; static readonly BUFF_SIZE: number = 4096; static readonly COMPONENT_SIZE: number = 200; static readonly ANIMATION_DURATION: number = 300; static readonly SANDBOX_PREFIX: string = "file:/...
AST#export_declaration#Left export AST#class_declaration#Left class BigFileCopyConstants AST#class_body#Left { AST#property_declaration#Left static readonly PROGRESS_MAX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Righ...
export class BigFileCopyConstants { static readonly PROGRESS_MAX: number = 100; static readonly PROGRESS_MIN: number = 0; static readonly BUFF_SIZE: number = 4096; static readonly COMPONENT_SIZE: number = 200; static readonly ANIMATION_DURATION: number = 300; static readonly SANDBOX_PREFIX: string = "file:/...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bigfilecopy/src/main/ets/constants/BigFileCopyConstants.ets#L16-L24
b4b2e23ee6b7586cd89be1c4cd463fe59d9e161f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
buildMainContent
构建主内容区域
@Builder buildMainContent() { Scroll() { Column({ space: 16 }) { // 根据当前Tab显示不同内容 if (this.currentTabIndex === 0) { this.buildHomeContent() } else if (this.currentTabIndex === 1) { this.buildContactsContent() } else if (this.currentTabIndex === 2) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMainContent 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 Scroll ( ) AST#container_content_body#Left { AST#arkts_ui...
@Builder buildMainContent() { Scroll() { Column({ space: 16 }) { if (this.currentTabIndex === 0) { this.buildHomeContent() } else if (this.currentTabIndex === 1) { this.buildContactsContent() } else if (this.currentTabIndex === 2) { this.buildCa...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L311-L332
3bd912b0a8f5918e7d233abfe1a03922a64da0f2
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleForeground
处理应用回到前台
private handleForeground(): void { // TODO: 刷新生日提醒数据 // TODO: 检查通知权限 // TODO: 更新UI状态 }
AST#method_declaration#Left private handleForeground 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 { // TODO: 刷新生日提醒数据 // TODO: 检查通知权限 // TODO: 更新UI状态 } AST#builder_function_body#...
private handleForeground(): void { }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L212-L216
29d5da224f4e792af54c39880d0dcabd8230651b
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/PureTabsExt/entry/src/main/ets/common/constant/Constants.ets
arkts
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...
export class Constants { /** * Full screen width. */ static readonly FULL_WIDTH: string = '100%'; /** * Full screen height. */ static readonly FULL_HEIGHT: string = '100%'; }
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { /** * Full screen width. */ AST#property_declaration#Left static readonly FULL_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '1...
export class Constants { static readonly FULL_WIDTH: string = '100%'; static readonly FULL_HEIGHT: string = '100%'; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/common/constant/Constants.ets#L16-L25
64ee668fd11b8fa8a4952fabd9de3965a4d06680
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
asDBPlan
MARK: - DBPlanとの交換 / 转换为 DBPlan
asDBPlan(): DBPlan { let dbPlan = new DBPlan(); dbPlan.planId = this.planId; dbPlan.planName = this.planName; dbPlan.bookId = this.bookId; dbPlan.countPerDay = this.countPerDay; dbPlan.startDate = this.startDate; dbPlan.distances = this.distances.join(","); dbPla...
AST#method_declaration#Left asDBPlan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DBPlan AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dbPlan = AST#exp...
asDBPlan(): DBPlan { let dbPlan = new DBPlan(); dbPlan.planId = this.planId; dbPlan.planName = this.planName; dbPlan.bookId = this.bookId; dbPlan.countPerDay = this.countPerDay; dbPlan.startDate = this.startDate; dbPlan.distances = this.distances.join(","); dbPla...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L408-L418
bb3626059622a3b35266dc41fd593df96665655b
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/common/component/TextMatchUtils.ets
arkts
topic
export class TopicMatchRegExp extends TextMatchRegExp { topicInfos: TopicInfoInterface[] = [] getTopicId(title: string): string { return this.topicInfos.find(element => element.title == title)?.topicId ?? '' }
AST#export_declaration#Left export AST#class_declaration#Left class TopicMatchRegExp extends AST#type_annotation#Left AST#primary_type#Left TextMatchRegExp AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#ERROR#Left topicInfos : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Lef...
export class TopicMatchRegExp extends TextMatchRegExp { topicInfos: TopicInfoInterface[] = [] getTopicId(title: string): string { return this.topicInfos.find(element => element.title == title)?.topicId ?? '' }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/common/component/TextMatchUtils.ets#L199-L204
c64533838ed2fbb3a064d6a4b3aeb1beb4a4f44b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVPlayerModel.ets
arkts
regAVPlayerCallback
注册avplayer回调函数 @param avPlayer AVPlayer实例 @param timeUpdateCb 歌曲时间更新回调 @param stateUpdateCb avplayer状态更新回调 @param completeCb avplayer单曲完成回调 @returns {void}
private regAVPlayerCallback( avPlayer: media.AVPlayer, timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function ): void { // seek操作结果回调函数 avPlayer.on('seekDone', (seekDoneTime: number) => { logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) // ...
AST#method_declaration#Left private regAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeU...
private regAVPlayerCallback( avPlayer: media.AVPlayer, timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function ): void { avPlayer.on('seekDone', (seekDoneTime: number) => { logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) avPlayer.on('...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVPlayerModel.ets#L83-L110
d746ebb80897bc943a9698ea287584857f243043
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets
arkts
deleteAddress
删除地址 @param {{ ids: number[] }} params - 地址 ID 集合 @returns {Promise<NetworkResponse<void>>} 删除结果
async deleteAddress(params: Ids): Promise<NetworkResponse<void>> { const resp: AxiosResponse<NetworkResponse<void>> = await NetworkClient.http.post("user/address/delete", params); return resp.data; }
AST#method_declaration#Left async deleteAddress AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Ids 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 ...
async deleteAddress(params: Ids): Promise<NetworkResponse<void>> { const resp: AxiosResponse<NetworkResponse<void>> = await NetworkClient.http.post("user/address/delete", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets#L48-L52
9f0a226431ce0e714a38a0d6ffefe4d420143df7
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
getNavStackByName
根据栈名获取路由栈,【初次调用会创建一个实例,并入参到Navigation构造方法中】 @param stackName @returns
public static getNavStackByName(stackName: string): NavPathStack { return ZRouter.getRouterMgr().getNavStackByName(stackName) }
AST#method_declaration#Left public static getNavStackByName AST#parameter_list#Left ( AST#parameter#Left stackName : 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 NavP...
public static getNavStackByName(stackName: string): NavPathStack { return ZRouter.getRouterMgr().getNavStackByName(stackName) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L253-L255
8177390cea40e6d80f20676c5fb026b3bc90ba5a
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/form/src/main/ets/default/view/FormManagerComponent.ets
arkts
clearNoUseFormById
Keep the form which be added to the desktop, and delete the remaining forms.
private clearNoUseFormById(): void { for (let i = 0; i < this.mFormIdMap.size; i++) { if (i != this.mSwiperIndex) { this.mFormModel.deleteFormByFormID(this.mFormIdMap.get(i)); } } }
AST#method_declaration#Left private clearNoUseFormById 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#for_statement#Left for ( AST#variable_declaration#Left let ...
private clearNoUseFormById(): void { for (let i = 0; i < this.mFormIdMap.size; i++) { if (i != this.mSwiperIndex) { this.mFormModel.deleteFormByFormID(this.mFormIdMap.get(i)); } } }
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/form/src/main/ets/default/view/FormManagerComponent.ets#L119-L125
73845def7586e6fb8a1fcbdceff2fc2a5b3b3e25
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/dialog/SelectDialog.ets
arkts
【系统】SelectDialog单选系统弹框 @description 该弹窗采用系统SelectDialog单选系统弹框view,所以样式和内容构建参照系统参数设置。(ISelectDialogOptions 即 SelectDialog 的参数)
export class SelectDialog extends BaseModalDialog implements IDialog { protected getBuilder(): WrappedBuilder<[IBaseDialogOptions]> { return wrapBuilder(SelectDialogBuilder) as WrappedBuilder<[IBaseDialogOptions]> } protected initModalOptions(options: ISelectDialogOptions): IBaseDialogOptions { return th...
AST#export_declaration#Left export AST#class_declaration#Left class SelectDialog extends AST#type_annotation#Left AST#primary_type#Left BaseModalDialog AST#primary_type#Right AST#type_annotation#Right AST#implements_clause#Left implements IDialog AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#...
export class SelectDialog extends BaseModalDialog implements IDialog { protected getBuilder(): WrappedBuilder<[IBaseDialogOptions]> { return wrapBuilder(SelectDialogBuilder) as WrappedBuilder<[IBaseDialogOptions]> } protected initModalOptions(options: ISelectDialogOptions): IBaseDialogOptions { return th...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/SelectDialog.ets#L12-L33
3622ff1468c3ace69d6634fcaeeeaa691c479d37
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/StatisticsPage.ets
arkts
onPageShow
页面生命周期 - 页面显示时
onPageShow() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'StatisticsPage onPageShow - refreshing statistics'); // 每次页面显示时刷新统计数据 this.loadStatisticsData(); }
AST#method_declaration#Left onPageShow 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 hilog AST#expression#Right . info AST#member_expressi...
onPageShow() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'StatisticsPage onPageShow - refreshing statistics'); this.loadStatisticsData(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/StatisticsPage.ets#L42-L46
8bf7e5b41d47a948e6a75e5a6f10d0741c243d89
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ArrayUtil.ets
arkts
union
平铺二维数组,并去重。 @param arrays 数组 @returns 返回一个新的数组
static union(arrays: string[][]): string[] { return Array.from(new Set(arrays.flat())); }
AST#method_declaration#Left static union AST#parameter_list#Left ( AST#parameter#Left arrays : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left...
static union(arrays: string[][]): string[] { return Array.from(new Set(arrays.flat())); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ArrayUtil.ets#L167-L169
09214ca7293fceda4edeef68dcc3da5016a77b08
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/router/AppRouter.ets
arkts
goGreetingSend
跳转到祝福语发送页面 @param contactId 联系人ID @param greetingId 祝福语ID(可选)
async goGreetingSend(contactId: string, greetingId?: string): Promise<void> { const params: RouteParams = { contactId, greetingId }; const options: RouteOptions = { params }; await this.push(RoutePaths.GREETING_SEND, options); }
AST#method_declaration#Left async goGreetingSend AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left greetingId ? : AST#type_annotation#Left AST#primary_type#Left string A...
async goGreetingSend(contactId: string, greetingId?: string): Promise<void> { const params: RouteParams = { contactId, greetingId }; const options: RouteOptions = { params }; await this.push(RoutePaths.GREETING_SEND, options); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L290-L294
d3c1d6d324a2c3a4417b64fe6d9066a284d95252
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/SetAppFontSize/entry/src/main/ets/common/database/PreferencesUtil.ets
arkts
The PreferencesUtil provides preferences of create, save and query.
export class PreferencesUtil { createFontPreferences(context: Context) { let fontPreferences: Function = (() => { let preferences: Promise<dataPreferences.Preferences> = dataPreferences.getPreferences(context, PREFERENCES_NAME); return preferences; }); GlobalContext.getContext().setObj...
AST#export_declaration#Left export AST#class_declaration#Left class PreferencesUtil AST#class_body#Left { AST#method_declaration#Left createFontPreferences AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#p...
export class PreferencesUtil { createFontPreferences(context: Context) { let fontPreferences: Function = (() => { let preferences: Promise<dataPreferences.Preferences> = dataPreferences.getPreferences(context, PREFERENCES_NAME); return preferences; }); GlobalContext.getContext().setObj...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/common/database/PreferencesUtil.ets#L27-L81
293931c49f71989e4aab4035368639b26c7dbc63
gitee