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
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/Cart.ets
arkts
@file 购物车模型 @author Joker.X
export class Cart { /** * 商品 id */ goodsId: number = 0; /** * 商品名称 */ goodsName: string = ""; /** * 商品主图 */ goodsMainPic: string = ""; /** * 规格 */ spec: CartGoodsSpec[] = []; constructor(init?: Partial<Cart>) { if (!init) { return; } this.goodsId = init.goodsId ?? this.goodsId; this.goodsName = init.goodsName ?? this.goodsName; this.goodsMainPic = init.goodsMainPic ?? this.goodsMainPic; this.spec = init.spec ? init.spec.map((s) => new CartGoodsSpec(s)) : this.spec; } }
AST#export_declaration#Left export AST#class_declaration#Left class Cart AST#class_body#Left { /** * 商品 id */ AST#property_declaration#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /** * 商品名称 */ AST#property_declaration#Left goodsName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right /** * 商品主图 */ AST#property_declaration#Left goodsMainPic : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right /** * 规格 */ AST#property_declaration#Left spec : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CartGoodsSpec [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : 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 Cart AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left init AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . goodsName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . goodsName AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . goodsName AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . goodsMainPic AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . goodsMainPic AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . goodsMainPic AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spec AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . spec AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left s AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CartGoodsSpec AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left s AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . spec AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Cart { goodsId: number = 0; goodsName: string = ""; goodsMainPic: string = ""; spec: CartGoodsSpec[] = []; constructor(init?: Partial<Cart>) { if (!init) { return; } this.goodsId = init.goodsId ?? this.goodsId; this.goodsName = init.goodsName ?? this.goodsName; this.goodsMainPic = init.goodsMainPic ?? this.goodsMainPic; this.spec = init.spec ? init.spec.map((s) => new CartGoodsSpec(s)) : this.spec; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Cart.ets#L7-L34
cfe776986546ba6cbc4e7868d82b88ab3921a985
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/HttpRequestMonitor/entry/src/main/ets/pages/Index.ets
arkts
sleep
休眠指定的毫秒数
function sleep(time: number): Promise<void> { return new Promise((resolve) => setTimeout(resolve, time)); }
AST#function_declaration#Left function sleep AST#parameter_list#Left ( AST#parameter#Left time : 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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left resolve AST#expression#Right , AST#expression#Left time AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function sleep(time: number): Promise<void> { return new Promise((resolve) => setTimeout(resolve, time)); }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/HttpRequestMonitor/entry/src/main/ets/pages/Index.ets#L148-L150
08176a11834ba72ac77c900f0ad90fcd27cc9b12
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/CacheHelper.ets
arkts
has
判断是否包含key对应的缓存
public static has(key: string): boolean { return CacheHelper.lruCache.contains(key); }
AST#method_declaration#Left public static has AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . lruCache AST#member_expression#Right AST#expression#Right . contains AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static has(key: string): boolean { return CacheHelper.lruCache.contains(key); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/CacheHelper.ets#L55-L57
c1508c1fc15d7df43c9f6a075ea68df035bd949e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
getRelationColor
根据关系获取标签颜色
private getRelationColor(relation: string): string { const colorMap: Record<string, string> = { '父亲': this.COLORS.primary, '母亲': this.COLORS.redPrimary, '兄弟': this.COLORS.greenPrimary, '姐妹': this.COLORS.orangePrimary, '朋友': this.COLORS.primary, '同事': this.COLORS.gray600, '同学': this.COLORS.greenPrimary, '老师': this.COLORS.gray700, '医生': this.COLORS.redPrimary }; return colorMap[relation] || this.COLORS.gray500; }
AST#method_declaration#Left private getRelationColor AST#parameter_list#Left ( AST#parameter#Left relation : 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left colorMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left '父亲' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '母亲' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . redPrimary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '兄弟' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . greenPrimary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '姐妹' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . orangePrimary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '朋友' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '同事' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . gray600 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '同学' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . greenPrimary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '老师' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . gray700 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '医生' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . redPrimary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left colorMap AST#expression#Right [ AST#expression#Left relation AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . gray500 AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getRelationColor(relation: string): string { const colorMap: Record<string, string> = { '父亲': this.COLORS.primary, '母亲': this.COLORS.redPrimary, '兄弟': this.COLORS.greenPrimary, '姐妹': this.COLORS.orangePrimary, '朋友': this.COLORS.primary, '同事': this.COLORS.gray600, '同学': this.COLORS.greenPrimary, '老师': this.COLORS.gray700, '医生': this.COLORS.redPrimary }; return colorMap[relation] || this.COLORS.gray500; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4027-L4041
ff2ed4d3ef26883058a736a4900848acc8fabaa4
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_uicontext/ace_ets_module_uicontext_api13/entry/src/main/ets/MainAbility/common/Log.ets
arkts
showInfo
print info level log @param {string} tag - Page or class tag @param {string} log - Log needs to be printed
static showInfo(tag: string, log: string){ console.info(`${TAG} tag: ${tag} --> ${log}`); }
AST#method_declaration#Left static showInfo AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tag: AST#template_substitution#Left $ { AST#expression#Left tag AST#expression#Right } AST#template_substitution#Right --> AST#template_substitution#Left $ { AST#expression#Left log AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static showInfo(tag: string, log: string){ console.info(`${TAG} tag: ${tag} --> ${log}`); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_uicontext/ace_ets_module_uicontext_api13/entry/src/main/ets/MainAbility/common/Log.ets#L28-L30
edd21cfc5862d5270e954fdcda172f2d1de620ce
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseManager.ets
arkts
initDatabase
初始化数据库 @param context 应用上下文
async initDatabase(context: Context): Promise<void> { try { const config: relationalStore.StoreConfig = { name: DatabaseSchema.DATABASE_NAME, securityLevel: relationalStore.SecurityLevel.S1 }; this.rdbStore = await relationalStore.getRdbStore(context, config); console.info('[DatabaseManager] Database initialized successfully'); // 检查并执行数据库升级 await this.checkAndUpgradeDatabase(); // 创建所有表 await this.createTables(); // 创建所有索引 await this.createIndexes(); console.info('[DatabaseManager] All tables and indexes created successfully'); } catch (error) { const err = error as Error; throw new Error(`Failed to initialize database: ${err.message}`); } }
AST#method_declaration#Left async initDatabase 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left config : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . StoreConfig AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = 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 DatabaseSchema AST#expression#Right . DATABASE_NAME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left securityLevel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left relationalStore AST#expression#Right . SecurityLevel AST#member_expression#Right AST#expression#Right . S1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left relationalStore AST#expression#Right AST#await_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left config AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseManager] Database initialized successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 检查并执行数据库升级 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . checkAndUpgradeDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 创建所有表 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . createTables AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 创建所有索引 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . createIndexes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[DatabaseManager] All tables and indexes created successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to initialize database: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async initDatabase(context: Context): Promise<void> { try { const config: relationalStore.StoreConfig = { name: DatabaseSchema.DATABASE_NAME, securityLevel: relationalStore.SecurityLevel.S1 }; this.rdbStore = await relationalStore.getRdbStore(context, config); console.info('[DatabaseManager] Database initialized successfully'); await this.checkAndUpgradeDatabase(); await this.createTables(); await this.createIndexes(); console.info('[DatabaseManager] All tables and indexes created successfully'); } catch (error) { const err = error as Error; throw new Error(`Failed to initialize database: ${err.message}`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseManager.ets#L45-L69
e991a62eb1ef1936eb1f258e6111a9d9213587f9
github
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/network/SearchStockApi.ets
arkts
搜索上交所或者深交所的股票Api
export class SearchStockApi { /** * 搜索股票Api * @param stockCode * @param callback */ public requestData(stockCode: string, callback: Callback<SearchStockResponse>) { //发起请求 var market = stockCode.startsWith('0') ? 'sz' : 'sh' let url = "http://yunhq.sse.com.cn:32041/v1/" + market + "1/list/exchange/equity?select=code,name,open,high,low,volume&_=" + new Date().getTime() console.log("请求的URL:" + url); sendHttpRequest(url).then((data) => { if (data.responseCode == http.ResponseCode.OK) { let response = data.result let jsonData = JSON.parse(response as string) const stockList = jsonData.list.map(item => new SearchStockBean(item[0], item[1], item[2], item[3], item[4], item[5], item[6])) const top50StockList = stockList .filter(stock => stock.code.includes(stockCode)) .slice(0, 50); const searchStockResponse = new SearchStockResponse(jsonData.date, jsonData.time, jsonData.total, jsonData.begin, jsonData.end, stockList, top50StockList); callback(searchStockResponse) } else { callback(null) } }).catch((error) => { callback(null) console.log('error:' + JSON.stringify(error)); }) } }
AST#export_declaration#Left export AST#class_declaration#Left class SearchStockApi AST#class_body#Left { /** * 搜索股票Api * @param stockCode * @param callback */ AST#method_declaration#Left public requestData AST#parameter_list#Left ( AST#parameter#Left stockCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SearchStockResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { //发起请求 AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left market = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stockCode AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left 'sz' AST#expression#Right : AST#expression#Left 'sh' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left url = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "http://yunhq.sse.com.cn:32041/v1/" AST#expression#Right + AST#expression#Left market AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "1/list/exchange/equity?select=code,name,open,high,low,volume&_=" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left "请求的URL:" AST#expression#Right + AST#expression#Left url AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sendHttpRequest AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right == AST#expression#Left http AST#expression#Right AST#binary_expression#Right AST#expression#Right . ResponseCode AST#member_expression#Right AST#expression#Right . OK AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left response = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left jsonData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left response AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left stockList = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . list AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SearchStockBean AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 3 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 4 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 5 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left item AST#expression#Right [ AST#expression#Left 6 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left top50StockList = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stockList AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left stock => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stock AST#expression#Right . code AST#member_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left stockCode AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 50 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left searchStockResponse = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SearchStockResponse AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . date AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . time AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . total AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . begin AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . end AST#member_expression#Right AST#expression#Right , AST#expression#Left stockList AST#expression#Right , AST#expression#Left top50StockList AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left searchStockResponse AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'error:' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class SearchStockApi { public requestData(stockCode: string, callback: Callback<SearchStockResponse>) { var market = stockCode.startsWith('0') ? 'sz' : 'sh' let url = "http://yunhq.sse.com.cn:32041/v1/" + market + "1/list/exchange/equity?select=code,name,open,high,low,volume&_=" + new Date().getTime() console.log("请求的URL:" + url); sendHttpRequest(url).then((data) => { if (data.responseCode == http.ResponseCode.OK) { let response = data.result let jsonData = JSON.parse(response as string) const stockList = jsonData.list.map(item => new SearchStockBean(item[0], item[1], item[2], item[3], item[4], item[5], item[6])) const top50StockList = stockList .filter(stock => stock.code.includes(stockCode)) .slice(0, 50); const searchStockResponse = new SearchStockResponse(jsonData.date, jsonData.time, jsonData.total, jsonData.begin, jsonData.end, stockList, top50StockList); callback(searchStockResponse) } else { callback(null) } }).catch((error) => { callback(null) console.log('error:' + JSON.stringify(error)); }) } }
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/network/SearchStockApi.ets#L7-L37
33a0b5d9179cf3710169d44f6c17f824c66339ee
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
entry/src/main/ets/utils/GlobalSwitchUtil.ets
arkts
requestGlobalSwitch
系统提供了超级隐私模式,在系统设置打开超级隐私模式后,相机、麦克风、位置将不可用。 在获取相机权限、麦克风权限和位置权限后,如果超级隐私模式开启,需要引导用户关闭超级隐私模式。 @param context @param permissions
static requestGlobalSwitch(context: Context, permissions: Array<Permissions>) { const locationPermission = "ohos.permission.LOCATION" as Permissions const approximatelyPermission = "ohos.permission.APPROXIMATELY_LOCATION" as Permissions const backgroundPermission = "ohos.permission.LOCATION_IN_BACKGROUND" as Permissions const microphonePermission = "ohos.permission.MICROPHONE" as Permissions const cameraPermission = "ohos.permission.CAMERA" as Permissions if (permissions.indexOf(locationPermission) >= 0 || permissions.indexOf(approximatelyPermission) >= 0 || permissions.indexOf(backgroundPermission) >= 0) { GlobalSwitchUtil.requestLocationGlobalSwitch(context) } else if (permissions.indexOf(microphonePermission) >= 0) { GlobalSwitchUtil.requestMicrophoneGlobalSwitch(context) } else if (permissions.indexOf(cameraPermission) >= 0) { GlobalSwitchUtil.requestCameraGlobalSwitch(context) } }
AST#method_declaration#Left static requestGlobalSwitch 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#Left permissions : 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 Permissions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left locationPermission = AST#expression#Left AST#as_expression#Left AST#expression#Left "ohos.permission.LOCATION" AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left approximatelyPermission = AST#expression#Left AST#as_expression#Left AST#expression#Left "ohos.permission.APPROXIMATELY_LOCATION" AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left backgroundPermission = AST#expression#Left AST#as_expression#Left AST#expression#Left "ohos.permission.LOCATION_IN_BACKGROUND" AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left microphonePermission = AST#expression#Left AST#as_expression#Left AST#expression#Left "ohos.permission.MICROPHONE" AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cameraPermission = AST#expression#Left AST#as_expression#Left AST#expression#Left "ohos.permission.CAMERA" AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left permissions AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left locationPermission AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left permissions AST#expression#Right AST#binary_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left approximatelyPermission AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left permissions AST#expression#Right AST#binary_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left backgroundPermission AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalSwitchUtil AST#expression#Right . requestLocationGlobalSwitch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left permissions AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left microphonePermission AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalSwitchUtil AST#expression#Right . requestMicrophoneGlobalSwitch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left permissions AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cameraPermission AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalSwitchUtil AST#expression#Right . requestCameraGlobalSwitch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static requestGlobalSwitch(context: Context, permissions: Array<Permissions>) { const locationPermission = "ohos.permission.LOCATION" as Permissions const approximatelyPermission = "ohos.permission.APPROXIMATELY_LOCATION" as Permissions const backgroundPermission = "ohos.permission.LOCATION_IN_BACKGROUND" as Permissions const microphonePermission = "ohos.permission.MICROPHONE" as Permissions const cameraPermission = "ohos.permission.CAMERA" as Permissions if (permissions.indexOf(locationPermission) >= 0 || permissions.indexOf(approximatelyPermission) >= 0 || permissions.indexOf(backgroundPermission) >= 0) { GlobalSwitchUtil.requestLocationGlobalSwitch(context) } else if (permissions.indexOf(microphonePermission) >= 0) { GlobalSwitchUtil.requestMicrophoneGlobalSwitch(context) } else if (permissions.indexOf(cameraPermission) >= 0) { GlobalSwitchUtil.requestCameraGlobalSwitch(context) } }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/entry/src/main/ets/utils/GlobalSwitchUtil.ets#L14-L28
4300925fa4864f36939e3b040c1dcb08311161b2
gitee
openharmony-sig/ohos_axios
75d72897982ea6e10fa99c62c62a65425af0a568
entry/src/main/ets/pages/Index.ets
arkts
creat
Creat请求
creat() { this.clear() this.showUrl = this.getUrl const instance = axios.create(); this.startTime = new Date().getTime(); instance.get<string, AxiosResponse<string>, null>(this.getUrl, { connectTimeout: this.connectTimeout, readTimeout: this.readTimeout, maxBodyLength: this.maxBodyLength, maxContentLength: this.maxContentLength }).then((res: AxiosResponse) => { this.status = res ? res.status : ''; this.message = res ? JSON.stringify(res.data) : ''; this.endTime = new Date().getTime(); }).catch((err: AxiosError) => { this.status = ''; this.message = err.message; this.endTime = new Date().getTime(); }) }
AST#method_declaration#Left creat 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 this AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showUrl AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUrl AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left instance = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axios AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left instance AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUrl AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . connectTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxBodyLength AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxBodyLength AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxContentLength AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxContentLength AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left AxiosResponse 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#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left res AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . status AST#member_expression#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left res AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left AxiosError 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#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
creat() { this.clear() this.showUrl = this.getUrl const instance = axios.create(); this.startTime = new Date().getTime(); instance.get<string, AxiosResponse<string>, null>(this.getUrl, { connectTimeout: this.connectTimeout, readTimeout: this.readTimeout, maxBodyLength: this.maxBodyLength, maxContentLength: this.maxContentLength }).then((res: AxiosResponse) => { this.status = res ? res.status : ''; this.message = res ? JSON.stringify(res.data) : ''; this.endTime = new Date().getTime(); }).catch((err: AxiosError) => { this.status = ''; this.message = err.message; this.endTime = new Date().getTime(); }) }
https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/pages/Index.ets#L375-L395
54298dafad0da6c173a8d3df2768949162a6afcc
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/AIModelManager.ets
arkts
支持的AI模型提供商
export enum AIProvider { ZHIPU = 'zhipu', // 智谱AI (原CHATGLM) DEEPSEEK = 'deepseek', // DeepSeek KIMI = 'kimi', // Kimi月之暗面 CUSTOM = 'custom' // 自定义 }
AST#export_declaration#Left export AST#enum_declaration#Left enum AIProvider AST#enum_body#Left { AST#enum_member#Left ZHIPU = AST#expression#Left 'zhipu' AST#expression#Right AST#enum_member#Right , // 智谱AI (原CHATGLM) AST#enum_member#Left DEEPSEEK = AST#expression#Left 'deepseek' AST#expression#Right AST#enum_member#Right , // DeepSeek AST#enum_member#Left KIMI = AST#expression#Left 'kimi' AST#expression#Right AST#enum_member#Right , // Kimi月之暗面 AST#enum_member#Left CUSTOM = AST#expression#Left 'custom' AST#expression#Right AST#enum_member#Right // 自定义 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum AIProvider { ZHIPU = 'zhipu', DEEPSEEK = 'deepseek', KIMI = 'kimi', CUSTOM = 'custom' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/AIModelManager.ets#L14-L19
a2d7ecf60d06f7a3335f052ba888f5c3c01c6006
github
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
entry/src/main/ets/pages/View/FestivalInfo.ets
arkts
aboutToAppear
private controller : FunctionController = new FunctionController(); private agentId : string = 'agent1ecc9bc0f8bb420f82b18a4320d8b8aa'
aboutToAppear(): void { this.festivalDetailInfo = FestivalDetailData[this.festivalName]; // this.checkAgentSupport(); // this.initListeners(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . festivalDetailInfo AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left FestivalDetailData AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . festivalName AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // this.checkAgentSupport(); // this.initListeners(); } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear(): void { this.festivalDetailInfo = FestivalDetailData[this.festivalName]; }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/pages/View/FestivalInfo.ets#L59-L63
4cee19825cc81eda276b1b67bc334132825eb259
github
zqf-dev/WAndroidHOS.git
e2e560a7c96110c43d13eb232826707601172b6d
entry/src/main/ets/request/Home.ets
arkts
请求Banner数据 @returns
export function getBanner(): Promise<IBannerModel[]> { return new Promise((resolve: Function, reject: Function) => { get(API.banner).then((data: Response) => { console.log("Tag", "data " + data) if (data.data && data.errorCode === API.SERVER_CODE_SUCCESS) { resolve(data.data); } else { console.log('getBannerList failed', JSON.stringify(data)); reject($r('app.string.page_none_msg')); } }).catch((err: Error) => { console.log('getBannerList failed', JSON.stringify(err)); reject($r('app.string.http_error_message')); }); }); }
AST#export_declaration#Left export AST#function_declaration#Left function getBanner 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 AST#array_type#Left IBannerModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reject : AST#type_annotation#Left AST#primary_type#Left Function 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#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left get AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left API AST#expression#Right . banner AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Response 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#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "Tag" AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left "data " AST#expression#Right + AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . data AST#member_expression#Right AST#expression#Right && AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . errorCode AST#member_expression#Right AST#expression#Right === AST#expression#Left API AST#expression#Right AST#binary_expression#Right AST#expression#Right . SERVER_CODE_SUCCESS AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getBannerList failed' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.page_none_msg' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error 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#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getBannerList failed' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.http_error_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getBanner(): Promise<IBannerModel[]> { return new Promise((resolve: Function, reject: Function) => { get(API.banner).then((data: Response) => { console.log("Tag", "data " + data) if (data.data && data.errorCode === API.SERVER_CODE_SUCCESS) { resolve(data.data); } else { console.log('getBannerList failed', JSON.stringify(data)); reject($r('app.string.page_none_msg')); } }).catch((err: Error) => { console.log('getBannerList failed', JSON.stringify(err)); reject($r('app.string.http_error_message')); }); }); }
https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/request/Home.ets#L11-L26
8fccf274181c331005ce02eb2db155acc4b6a07a
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/view/ClockArea.ets
arkts
drawPointer
绘制时针、分针、秒针。 @param degree 指针转动的角度。 @param pointerImgRes 指针图片地址。
private drawPointer(degree: number, pointerImgRes: string): void { this.renderContext.save(); let theta = (degree + MainConstant.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / MainConstant.DEFAULT_HORIZONTAL_ANGLE; this.renderContext.rotate(theta); this.renderContext.beginPath(); let secondImg = new ImageBitmap(pointerImgRes); let imgWidth = 10; this.renderContext.drawImage( secondImg, -imgWidth / 2, -this.clockRadius, imgWidth, this.clockRadius * 2); this.renderContext.restore(); }
AST#method_declaration#Left private drawPointer AST#parameter_list#Left ( AST#parameter#Left degree : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pointerImgRes : 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 void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . renderContext AST#member_expression#Right AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left theta = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left degree AST#expression#Right + AST#expression#Left MainConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEFAULT_HORIZONTAL_ANGLE AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . PI AST#member_expression#Right AST#expression#Right / AST#expression#Left MainConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEFAULT_HORIZONTAL_ANGLE AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . renderContext AST#member_expression#Right AST#expression#Right . rotate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left theta AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . renderContext AST#member_expression#Right AST#expression#Right . beginPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left secondImg = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImageBitmap AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pointerImgRes AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imgWidth = AST#expression#Left 10 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . renderContext AST#member_expression#Right AST#expression#Right . drawImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left secondImg AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left imgWidth AST#expression#Right AST#unary_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . clockRadius AST#member_expression#Right AST#expression#Right , AST#expression#Left imgWidth AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clockRadius AST#member_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . renderContext AST#member_expression#Right AST#expression#Right . restore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private drawPointer(degree: number, pointerImgRes: string): void { this.renderContext.save(); let theta = (degree + MainConstant.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / MainConstant.DEFAULT_HORIZONTAL_ANGLE; this.renderContext.rotate(theta); this.renderContext.beginPath(); let secondImg = new ImageBitmap(pointerImgRes); let imgWidth = 10; this.renderContext.drawImage( secondImg, -imgWidth / 2, -this.clockRadius, imgWidth, this.clockRadius * 2); this.renderContext.restore(); }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/ClockArea.ets#L132-L146
49b36571c3e7b572090180a7f7d838ac08c4f24c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets
arkts
decodePKCS1
解密 @param decodeStr 待解密的字符串 @param priKey RSA私钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static decodePKCS1(str: string, priKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding, isPem); }
AST#method_declaration#Left static decodePKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right , AST#parameter#Left isPem : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . decodeAsym AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'RSA1024' AST#expression#Right , AST#expression#Left 'RSA1024|PKCS1' AST#expression#Right , AST#expression#Left 1024 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left dataCoding AST#expression#Right , AST#expression#Left isPem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static decodePKCS1(str: string, priKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> { return CryptoSyncUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L110-L113
c7a7705555d3c074d8018598829466d3069e4162
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets
arkts
validateInput
验证输入
validateInput(): boolean { let isValid = true; // 验证昵称 if (!this.userInfo.nickname || this.userInfo.nickname.trim() === '') { this.nicknameError = '昵称不能为空'; isValid = false; } else { this.nicknameError = ''; } // 验证邮箱 if (this.userInfo.email && this.userInfo.email.trim() !== '') { const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRegex.test(this.userInfo.email)) { this.emailError = '邮箱格式不正确'; isValid = false; } else { this.emailError = ''; } } else { this.emailError = ''; } // 验证手机号 if (this.userInfo.phone && this.userInfo.phone.trim() !== '') { const phoneRegex = /^1[3-9]\d{9}$/; if (!phoneRegex.test(this.userInfo.phone)) { this.phoneError = '手机号格式不正确'; isValid = false; } else { this.phoneError = ''; } } else { this.phoneError = ''; } return isValid; }
AST#method_declaration#Left validateInput AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isValid = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 验证昵称 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . nickname AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . nickname AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nicknameError AST#member_expression#Right = AST#expression#Left '昵称不能为空' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isValid = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nicknameError AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 验证邮箱 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . email AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . email AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left emailRegex = AST#ERROR#Left / ^ AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#expression#Right AST#ERROR#Left ^ \s @ AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right + AST#ERROR#Left @ AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#expression#Right AST#ERROR#Left ^ \s @ AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#ERROR#Left \ . AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#expression#Right AST#ERROR#Left ^ \s @ AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left + $ / AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right 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#unary_expression#Left ! AST#expression#Left emailRegex AST#expression#Right AST#unary_expression#Right AST#expression#Right . test AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . email AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . emailError AST#member_expression#Right = AST#expression#Left '邮箱格式不正确' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isValid = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . emailError AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . emailError AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 验证手机号 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left phoneRegex AST#variable_declarator#Right AST#ERROR#Left = AST#ERROR#Left / ^ AST#expression#Left AST#subscript_expression#Left AST#expression#Left 1 AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left 3 AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right \d { AST#property_name#Left 9 AST#property_name#Right } AST#ERROR#Right $ / AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right 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#unary_expression#Left ! AST#expression#Left phoneRegex AST#expression#Right AST#unary_expression#Right AST#expression#Right . test AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phoneError AST#member_expression#Right = AST#expression#Left '手机号格式不正确' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left isValid = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phoneError AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phoneError AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left isValid AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
validateInput(): boolean { let isValid = true; if (!this.userInfo.nickname || this.userInfo.nickname.trim() === '') { this.nicknameError = '昵称不能为空'; isValid = false; } else { this.nicknameError = ''; } if (this.userInfo.email && this.userInfo.email.trim() !== '') { const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRegex.test(this.userInfo.email)) { this.emailError = '邮箱格式不正确'; isValid = false; } else { this.emailError = ''; } } else { this.emailError = ''; } if (this.userInfo.phone && this.userInfo.phone.trim() !== '') { const phoneRegex = /^1[3-9]\d{9}$/; if (!phoneRegex.test(this.userInfo.phone)) { this.phoneError = '手机号格式不正确'; isValid = false; } else { this.phoneError = ''; } } else { this.phoneError = ''; } return isValid; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets#L112-L150
dbb8c007e8754ae1366bf13954e11e28609e574d
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/http/Request.ets
arkts
导出 axios 实例
export default service
AST#export_declaration#Left export default AST#expression#Left service AST#expression#Right AST#export_declaration#Right
export default service
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/http/Request.ets#L116-L116
47fcd596820456b5e04d99cdaa10724c14fea2a3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/highlight/BarHighlighter.ets
arkts
getStackedHighlight
This method creates the Highlight object that also indicates which value of a stacked BarEntry has been selected. @param high the Highlight to work with looking for stacked values @param set @param xVal @param yVal @return
public getStackedHighlight(high: Highlight, set: IBarDataSet, xVal: number, yVal: number): Highlight | null { let entry: BarEntry | null = set.getEntryForXValue(xVal, yVal); if (entry == null) return null; // not stacked if (entry.getYVals() == null) { return high; } else { let ranges: Range[] | null = entry.getRanges(); if (!ranges) { return null; } if (ranges.length > 0) { let stackIndex: number = this.getClosestStackIndex(ranges, yVal); let pixels: MPPointD = MPPointD.getInstance(0, 0); let transformer: Transformer | null = this.mChart.getTransformer(set.getAxisDependency()); if (transformer) { pixels = transformer.getPixelForValues(high.getX(), ranges[stackIndex].to); } let stackedHigh: Highlight = new Highlight( entry.getX(), entry.getY(), high.getDataSetIndex(), 0, stackIndex, pixels.x, pixels.y, high.getAxis() ); MPPointD.recycleInstance(pixels); return stackedHigh; } } return null; }
AST#method_declaration#Left public getStackedHighlight AST#parameter_list#Left ( AST#parameter#Left high : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left set : AST#type_annotation#Left AST#primary_type#Left IBarDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left xVal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left yVal : 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#union_type#Left AST#primary_type#Left Highlight AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left entry : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BarEntry AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set AST#expression#Right . getEntryForXValue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left xVal AST#expression#Right , AST#expression#Left yVal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left entry AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // not stacked AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entry AST#expression#Right . getYVals AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left high AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ranges : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left Range [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entry AST#expression#Right . getRanges AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left ranges AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ranges AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left stackIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getClosestStackIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ranges AST#expression#Right , AST#expression#Left yVal AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pixels : AST#type_annotation#Left AST#primary_type#Left MPPointD AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MPPointD AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left transformer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Transformer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getTransformer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left set AST#expression#Right . getAxisDependency AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left transformer AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pixels = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left transformer AST#expression#Right . getPixelForValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left high AST#expression#Right . getX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left ranges AST#expression#Right [ AST#expression#Left stackIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . to AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left stackedHigh : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Highlight AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entry AST#expression#Right . getX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entry AST#expression#Right . getY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left high AST#expression#Right . getDataSetIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left stackIndex AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left pixels AST#expression#Right . x AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left pixels AST#expression#Right . y AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left high AST#expression#Right . getAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MPPointD AST#expression#Right . recycleInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixels AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left stackedHigh AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getStackedHighlight(high: Highlight, set: IBarDataSet, xVal: number, yVal: number): Highlight | null { let entry: BarEntry | null = set.getEntryForXValue(xVal, yVal); if (entry == null) return null; if (entry.getYVals() == null) { return high; } else { let ranges: Range[] | null = entry.getRanges(); if (!ranges) { return null; } if (ranges.length > 0) { let stackIndex: number = this.getClosestStackIndex(ranges, yVal); let pixels: MPPointD = MPPointD.getInstance(0, 0); let transformer: Transformer | null = this.mChart.getTransformer(set.getAxisDependency()); if (transformer) { pixels = transformer.getPixelForValues(high.getX(), ranges[stackIndex].to); } let stackedHigh: Highlight = new Highlight( entry.getX(), entry.getY(), high.getDataSetIndex(), 0, stackIndex, pixels.x, pixels.y, high.getAxis() ); MPPointD.recycleInstance(pixels); return stackedHigh; } } return null; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/BarHighlighter.ets#L65-L105
2fa91aafa5e94504740dbf143745faa8212ed08b
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Transformer.ets
arkts
generateTransformedValuesLine
Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the LINECHART. @param data @return
public generateTransformedValuesLine(data: ILineDataSet, phaseX: number, phaseY: number, min: number, max: number): number[] { const count: number = Math.floor((((max - min) * phaseX) + 1) * 2); if (this.valuePointsForGenerateTransformedValuesLine.length != count) { this.valuePointsForGenerateTransformedValuesLine = new Array<number>(count); } let valuePoints: number[] = this.valuePointsForGenerateTransformedValuesLine; for (let j = 0; j < count; j += 2) { let e: Entry | null = data.getEntryForIndex(j / 2 + min); if (e != null) { valuePoints[j] = e.getX(); valuePoints[j + 1] = e.getY() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; } } this.getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
AST#method_declaration#Left public generateTransformedValuesLine AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ILineDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right - AST#expression#Left min AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left phaseX AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesLine AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right != AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesLine AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left count AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left valuePoints : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesLine AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left j = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left j += AST#expression#Left 2 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Entry AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left min AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left e AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = e AST#ERROR#Right . getX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = e AST#ERROR#Right . getY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left phaseY AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 0 AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 0 AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getValueToPixelMatrix AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . mapPoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left valuePoints AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left valuePoints AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public generateTransformedValuesLine(data: ILineDataSet, phaseX: number, phaseY: number, min: number, max: number): number[] { const count: number = Math.floor((((max - min) * phaseX) + 1) * 2); if (this.valuePointsForGenerateTransformedValuesLine.length != count) { this.valuePointsForGenerateTransformedValuesLine = new Array<number>(count); } let valuePoints: number[] = this.valuePointsForGenerateTransformedValuesLine; for (let j = 0; j < count; j += 2) { let e: Entry | null = data.getEntryForIndex(j / 2 + min); if (e != null) { valuePoints[j] = e.getX(); valuePoints[j + 1] = e.getY() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; } } this.getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L180-L207
83716d3137d94f786a24b41e3cad687fd1fddaf8
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pendingitems/src/main/ets/pages/ToDoList.ets
arkts
待办可选事项
build() { Column() { Row({ space: STYLE_CONFIG.LIST_ITEM_GUTTER }) { Text($r('app.string.pendingitems_todo')) .fontSize($r('sys.float.ohos_id_text_size_headline7')) Blank() Image($r('app.media.pendingitems_ic_public_add_filled')) .id('add_items') .width(STYLE_CONFIG.MENU_IMAGE_SIZE) .aspectRatio(1) .onClick(() => { // TODO:知识点:1.根据文本选择的选择结果,向待办事项数组中添加数据 TextPickerDialog.show({ range: this.availableThings, onAccept: (value: TextPickerResult) => { this.toDoData.unshift(new ToDo(this.availableThings[Number(value.index)])); }, }) }) } .height($r('app.string.pendingitems_title_height')) .width($r('app.string.pendingitems_max_size')) .padding({ left: $r('sys.float.ohos_id_max_padding_start'), right: $r('sys.float.ohos_id_max_padding_end'), }) .backgroundColor(Color.White) // TODO:知识点:2.待办数据显示列表组件绑定数据变量toDoData List({ initialIndex: 0, space: STYLE_CONFIG.LIST_ITEM_GUTTER }) { // 未完成列表项 if (this.toDoData.length !== 0) { ListItem() { Text($r('app.string.pendingitems_undo')) .fontSize($r('sys.float.ohos_id_text_size_headline8')) } } // 性能知识点:ForEach主要用于循环数据量小的数据,数据量大建议使用LazyForEach ForEach(this.toDoData, (toDoItem: ToDo, index: number) => { ListItem() { ToDoListItem({ toDoItem: toDoItem, achieveData: $achieveData, toDoData: $toDoData }) } // TODO:知识点:3.设置ListItem的swipeAction属性,左滑时,显示自定义UI视图 .swipeAction({ end: this.itemEnd(toDoItem), edgeEffect: SwipeEdgeEffect.Spring }) }, (toDoItem: ToDo, index: number) => toDoItem.key) // 已完成列表项 if (this.achieveData.length !== 0) { ListItem() { Text($r('app.string.pendingitems_done')) .fontSize($r('sys.float.ohos_id_text_size_headline8')) } } ForEach(this.achieveData, (toDoItem: ToDo, index: number) => { ListItem() { ToDoListItem({ toDoItem: toDoItem, achieveData: $achieveData, toDoData: $toDoData }) } .swipeAction({ end: this.itemEnd(toDoItem), edgeEffect: SwipeEdgeEffect.Spring }) }, (toDoItem: ToDo, index: number) => toDoItem.key) } .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) .layoutWeight(1) .listDirection(Axis.Vertical) .edgeEffect(EdgeEffect.Spring) .padding({ top: $r('sys.float.ohos_id_default_padding_top'), left: $r('sys.float.ohos_id_default_padding_start'), right: $r('sys.float.ohos_id_default_padding_end'), }) } .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) .backgroundColor($r('app.color.pendingitems_pageBcColor')) .width($r('app.string.pendingitems_max_size')) .height($r('app.string.pendingitems_max_size')) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIG AST#expression#Right . LIST_ITEM_GUTTER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pendingitems_todo' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_text_size_headline7' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.pendingitems_ic_public_add_filled' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'add_items' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIG AST#expression#Right . MENU_IMAGE_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // TODO:知识点:1.根据文本选择的选择结果,向待办事项数组中添加数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextPickerDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left range AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . availableThings AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAccept AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left TextPickerResult 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#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toDoData AST#member_expression#Right AST#expression#Right . unshift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ToDo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . availableThings AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . index AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pendingitems_title_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pendingitems_max_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_max_padding_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_max_padding_end' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // TODO:知识点:2.待办数据显示列表组件绑定数据变量toDoData AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left initialIndex : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIG AST#expression#Right . LIST_ITEM_GUTTER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 未完成列表项 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toDoData AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right !== AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pendingitems_undo' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_text_size_headline8' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 性能知识点:ForEach主要用于循环数据量小的数据,数据量大建议使用LazyForEach AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toDoData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left toDoItem : AST#type_annotation#Left AST#primary_type#Left ToDo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ToDoListItem ( AST#component_parameters#Left { AST#component_parameter#Left toDoItem : AST#expression#Left toDoItem AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left achieveData : AST#expression#Left $achieveData AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toDoData : AST#expression#Left $toDoData AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right // TODO:知识点:3.设置ListItem的swipeAction属性,左滑时,显示自定义UI视图 AST#modifier_chain_expression#Left . swipeAction ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left end AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toDoItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left edgeEffect AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left SwipeEdgeEffect AST#expression#Right . Spring AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left toDoItem : AST#type_annotation#Left AST#primary_type#Left ToDo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#expression#Left AST#member_expression#Left AST#expression#Left toDoItem AST#expression#Right . key AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right // 已完成列表项 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . achieveData AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right !== AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pendingitems_done' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_text_size_headline8' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . achieveData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left toDoItem : AST#type_annotation#Left AST#primary_type#Left ToDo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ToDoListItem ( AST#component_parameters#Left { AST#component_parameter#Left toDoItem : AST#expression#Left toDoItem AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left achieveData : AST#expression#Left $achieveData AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toDoData : AST#expression#Left $toDoData AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . swipeAction ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left end AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toDoItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left edgeEffect AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left SwipeEdgeEffect AST#expression#Right . Spring AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left toDoItem : AST#type_annotation#Left AST#primary_type#Left ToDo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#expression#Left AST#member_expression#Left AST#expression#Left toDoItem AST#expression#Right . key AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . Spring AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_default_padding_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_default_padding_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_default_padding_end' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pendingitems_pageBcColor' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pendingitems_max_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pendingitems_max_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Column() { Row({ space: STYLE_CONFIG.LIST_ITEM_GUTTER }) { Text($r('app.string.pendingitems_todo')) .fontSize($r('sys.float.ohos_id_text_size_headline7')) Blank() Image($r('app.media.pendingitems_ic_public_add_filled')) .id('add_items') .width(STYLE_CONFIG.MENU_IMAGE_SIZE) .aspectRatio(1) .onClick(() => { TextPickerDialog.show({ range: this.availableThings, onAccept: (value: TextPickerResult) => { this.toDoData.unshift(new ToDo(this.availableThings[Number(value.index)])); }, }) }) } .height($r('app.string.pendingitems_title_height')) .width($r('app.string.pendingitems_max_size')) .padding({ left: $r('sys.float.ohos_id_max_padding_start'), right: $r('sys.float.ohos_id_max_padding_end'), }) .backgroundColor(Color.White) List({ initialIndex: 0, space: STYLE_CONFIG.LIST_ITEM_GUTTER }) { if (this.toDoData.length !== 0) { ListItem() { Text($r('app.string.pendingitems_undo')) .fontSize($r('sys.float.ohos_id_text_size_headline8')) } } ForEach(this.toDoData, (toDoItem: ToDo, index: number) => { ListItem() { ToDoListItem({ toDoItem: toDoItem, achieveData: $achieveData, toDoData: $toDoData }) } .swipeAction({ end: this.itemEnd(toDoItem), edgeEffect: SwipeEdgeEffect.Spring }) }, (toDoItem: ToDo, index: number) => toDoItem.key) if (this.achieveData.length !== 0) { ListItem() { Text($r('app.string.pendingitems_done')) .fontSize($r('sys.float.ohos_id_text_size_headline8')) } } ForEach(this.achieveData, (toDoItem: ToDo, index: number) => { ListItem() { ToDoListItem({ toDoItem: toDoItem, achieveData: $achieveData, toDoData: $toDoData }) } .swipeAction({ end: this.itemEnd(toDoItem), edgeEffect: SwipeEdgeEffect.Spring }) }, (toDoItem: ToDo, index: number) => toDoItem.key) } .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) .layoutWeight(1) .listDirection(Axis.Vertical) .edgeEffect(EdgeEffect.Spring) .padding({ top: $r('sys.float.ohos_id_default_padding_top'), left: $r('sys.float.ohos_id_default_padding_start'), right: $r('sys.float.ohos_id_default_padding_end'), }) } .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) .backgroundColor($r('app.color.pendingitems_pageBcColor')) .width($r('app.string.pendingitems_max_size')) .height($r('app.string.pendingitems_max_size')) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pendingitems/src/main/ets/pages/ToDoList.ets#L47-L129
269bb7d6c4423a9742b508735da0ec577cf3ddc5
gitee
Leeson-Wong/ark-layer.git
9efa3553414a6b1eee890e3858c8cdcb308535d7
core/PhaseConfig.ets
arkts
阶段配置接口 用于定义 Service 加载阶段的配置
export interface PhaseConfig { name: string // 阶段名称,用于标识和日志 priority: number // 优先级,数字越小越先加载 waitForComplete: boolean // 是否等待该阶段所有节点完成才进入下一阶段 description?: string // 阶段描述(可选) }
AST#export_declaration#Left export AST#interface_declaration#Left interface PhaseConfig AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 阶段名称,用于标识和日志 AST#type_member#Left priority : 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 waitForComplete : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 是否等待该阶段所有节点完成才进入下一阶段 AST#type_member#Left description ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 阶段描述(可选) } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface PhaseConfig { name: string priority: number waitForComplete: boolean description?: string }
https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseConfig.ets#L5-L10
918538bf99072288c6a42bf741dac13f7b5601cc
github
0dot618/my_PCB_detection_harmony_app.git
58217366ac936b5f4c246191701b333f4d3c5513
MyApplication2/entry/src/main/ets/pages/Detect.ets
arkts
DetectBuilder
@Entry
@Builder export function DetectBuilder(name: string, param: Object) { Detect() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function DetectBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Detect ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function DetectBuilder(name: string, param: Object) { Detect() }
https://github.com/0dot618/my_PCB_detection_harmony_app.git/blob/58217366ac936b5f4c246191701b333f4d3c5513/MyApplication2/entry/src/main/ets/pages/Detect.ets#L41-L44
e7d4adc315e112950b28528ccbd4f841efc59852
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets
arkts
NodeController的子类MyNodeController
export class MyNodeController extends NodeController { private rootNode: FrameNode | null = null; // 根节点 rootRenderNode: RenderNode | null = null; // 从NodeController根节点获取的RenderNode,用于添加和删除新创建的MyRenderNode实例 width: number = 0; // 实例绑定的NodeContainer组件的宽,单位px height: number = 0; // 实例绑定的NodeContainer组件的宽,单位px // MyNodeController实例绑定的NodeContainer创建时触发,创建根节点rootNode并将其挂载至NodeContainer makeNode(uiContext: UIContext): FrameNode { this.rootNode = new FrameNode(uiContext); if (this.rootNode !== null) { this.rootRenderNode = this.rootNode.getRenderNode(); } return this.rootNode; } // 绑定的NodeContainer布局时触发,获取NodeContainer的宽高 aboutToResize(size: Size): void { this.width = size.width; this.height = size.height; // 设置画布底色为白色 if (this.rootRenderNode !== null) { // NodeContainer布局完成后设置rootRenderNode的背景色为白色 this.rootRenderNode.backgroundColor = 0XFFFFFFFF; // rootRenderNode的位置从组件NodeContainer的左上角(0,0)坐标开始,大小为NodeContainer的宽高 this.rootRenderNode.frame = { x: 0, y: 0, width: this.width, height: this.height }; } } }
AST#export_declaration#Left export AST#class_declaration#Left class MyNodeController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootNode : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left FrameNode AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 根节点 AST#property_declaration#Left rootRenderNode : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RenderNode AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 从NodeController根节点获取的RenderNode,用于添加和删除新创建的MyRenderNode实例 AST#property_declaration#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 实例绑定的NodeContainer组件的宽,单位px AST#property_declaration#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 实例绑定的NodeContainer组件的宽,单位px // MyNodeController实例绑定的NodeContainer创建时触发,创建根节点rootNode并将其挂载至NodeContainer AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FrameNode AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left FrameNode AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uiContext AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootRenderNode AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right . getRenderNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 绑定的NodeContainer布局时触发,获取NodeContainer的宽高 AST#method_declaration#Left aboutToResize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left size AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 设置画布底色为白色 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootRenderNode AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // NodeContainer布局完成后设置rootRenderNode的背景色为白色 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootRenderNode AST#member_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right = AST#expression#Left 0XFFFFFFFF AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // rootRenderNode的位置从组件NodeContainer的左上角(0,0)坐标开始,大小为NodeContainer的宽高 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootRenderNode AST#member_expression#Right AST#expression#Right . frame AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class MyNodeController extends NodeController { private rootNode: FrameNode | null = null; rootRenderNode: RenderNode | null = null; width: number = 0; height: number = 0; makeNode(uiContext: UIContext): FrameNode { this.rootNode = new FrameNode(uiContext); if (this.rootNode !== null) { this.rootRenderNode = this.rootNode.getRenderNode(); } return this.rootNode; } aboutToResize(size: Size): void { this.width = size.width; this.height = size.height; if (this.rootRenderNode !== null) { this.rootRenderNode.backgroundColor = 0XFFFFFFFF; this.rootRenderNode.frame = { x: 0, y: 0, width: this.width, height: this.height }; } } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets#L49-L76
611015d379af4631797da70af02f35df850ef113
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/PreferenceModel.ets
arkts
getToken
获取date日期对应的浏览历史
async getToken() { return 'eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MTk4NDE4NjUsInN1YiI6IntcImF2YXRlclwiOlwiL3N0YXRpYy91c2VyL2F2YXRlci_lkLTmgKjlkLTmgpQuanBnXCIsXCJiaXJ0aGRheVwiOlwiMTk5MC0xMC04XCIsXCJjcmVhdGVEYXRlXCI6MTU2NTcwMTMxNjAwMCxcImRpc2FibGVkXCI6MCxcImVtYWlsXCI6XCIyNzUwMTg3MjNAcXEuY29tXCIsXCJwZXJtaXNzaW9uXCI6MCxcInJvbGVcIjpcInB1YmxpY1wiLFwic2V4XCI6XCLnlLdcIixcInNpZ25cIjpcIuaXoOaAqO-8jOacieaClFwiLFwidGVsZXBob25lXCI6XCIxNTMwMjY4Njk0N1wiLFwidXBkYXRlRGF0ZVwiOjE1NjU3MDEzMjIwMDAsXCJ1c2VySWRcIjpcIuWQtOW_p-WQtOiZkVwiLFwidXNlcm5hbWVcIjpcIuWQtOW_p-WQtOiZkVwifSIsImV4cCI6MTcyMjQzMzg2NX0.GbEsgtlPl4SaN9ccE9L1EDlmHDZ3cyWyJbtqlsUas0E'; // let token = <string> await this.getPreference('token') // return token ?? null }
AST#method_declaration#Left async getToken AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 'eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MTk4NDE4NjUsInN1YiI6IntcImF2YXRlclwiOlwiL3N0YXRpYy91c2VyL2F2YXRlci_lkLTmgKjlkLTmgpQuanBnXCIsXCJiaXJ0aGRheVwiOlwiMTk5MC0xMC04XCIsXCJjcmVhdGVEYXRlXCI6MTU2NTcwMTMxNjAwMCxcImRpc2FibGVkXCI6MCxcImVtYWlsXCI6XCIyNzUwMTg3MjNAcXEuY29tXCIsXCJwZXJtaXNzaW9uXCI6MCxcInJvbGVcIjpcInB1YmxpY1wiLFwic2V4XCI6XCLnlLdcIixcInNpZ25cIjpcIuaXoOaAqO-8jOacieaClFwiLFwidGVsZXBob25lXCI6XCIxNTMwMjY4Njk0N1wiLFwidXBkYXRlRGF0ZVwiOjE1NjU3MDEzMjIwMDAsXCJ1c2VySWRcIjpcIuWQtOW_p-WQtOiZkVwiLFwidXNlcm5hbWVcIjpcIuWQtOW_p-WQtOiZkVwifSIsImV4cCI6MTcyMjQzMzg2NX0.GbEsgtlPl4SaN9ccE9L1EDlmHDZ3cyWyJbtqlsUas0E' AST#expression#Right ; AST#return_statement#Right AST#statement#Right // let token = <string> await this.getPreference('token') // return token ?? null } AST#block_statement#Right AST#method_declaration#Right
async getToken() { return 'eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3MTk4NDE4NjUsInN1YiI6IntcImF2YXRlclwiOlwiL3N0YXRpYy91c2VyL2F2YXRlci_lkLTmgKjlkLTmgpQuanBnXCIsXCJiaXJ0aGRheVwiOlwiMTk5MC0xMC04XCIsXCJjcmVhdGVEYXRlXCI6MTU2NTcwMTMxNjAwMCxcImRpc2FibGVkXCI6MCxcImVtYWlsXCI6XCIyNzUwMTg3MjNAcXEuY29tXCIsXCJwZXJtaXNzaW9uXCI6MCxcInJvbGVcIjpcInB1YmxpY1wiLFwic2V4XCI6XCLnlLdcIixcInNpZ25cIjpcIuaXoOaAqO-8jOacieaClFwiLFwidGVsZXBob25lXCI6XCIxNTMwMjY4Njk0N1wiLFwidXBkYXRlRGF0ZVwiOjE1NjU3MDEzMjIwMDAsXCJ1c2VySWRcIjpcIuWQtOW_p-WQtOiZkVwiLFwidXNlcm5hbWVcIjpcIuWQtOW_p-WQtOiZkVwifSIsImV4cCI6MTcyMjQzMzg2NX0.GbEsgtlPl4SaN9ccE9L1EDlmHDZ3cyWyJbtqlsUas0E'; }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L71-L75
72f166aabcf65eaf40d24fd0f10dcc731e7d2cf8
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/RankingDemo/entry/src/main/ets/model/DataModel.ets
arkts
rankData1
the Mock file instead of network data.
export { rankData1, rankData2 }
AST#export_declaration#Left export { rankData1 , rankData2 } AST#export_declaration#Right
export { rankData1, rankData2 }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/RankingDemo/entry/src/main/ets/model/DataModel.ets#L21-L21
be2f79d75db55a6b95b622810e7a5847865db711
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ThreadUtils.ets
arkts
isMainThread
判断当前是否为主线程
static isMainThread(): boolean { return process.tid === process.pid; // 主线程时两者相等 }
AST#method_declaration#Left static isMainThread AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left process AST#expression#Right . tid AST#member_expression#Right AST#expression#Right === AST#expression#Left process AST#expression#Right AST#binary_expression#Right AST#expression#Right . pid AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 主线程时两者相等 } AST#block_statement#Right AST#method_declaration#Right
static isMainThread(): boolean { return process.tid === process.pid; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ThreadUtils.ets#L9-L11
213499b9d853748f05d811aaf302bb84e3a925d2
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
delete
/删除Plan
public static async delete(plan: Plan): Promise<void> { //删除Plan //事务执行Delete(Plan+Piece+Box+Learn) await PlanDbAccess.shared.deletePlanTransaction(plan.asDBPlan()); //发送通知 SimpleEventBus.emit(PlanManagerNotification.namePlanUpdated, plan.planId) }
AST#method_declaration#Left public static async delete AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left Plan AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { //删除Plan //事务执行Delete(Plan+Piece+Box+Learn) AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PlanDbAccess AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . deletePlanTransaction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . asDBPlan AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right //发送通知 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SimpleEventBus AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left PlanManagerNotification AST#expression#Right . namePlanUpdated AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left plan AST#expression#Right . planId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public static async delete(plan: Plan): Promise<void> { await PlanDbAccess.shared.deletePlanTransaction(plan.asDBPlan()); SimpleEventBus.emit(PlanManagerNotification.namePlanUpdated, plan.planId) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L239-L246
6a14539fffbf84d614d05b15b58bfd694279b580
github
RicardoWesleyli/HarmonyNEXT_Examples.git
6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670
Chapter6/entry/src/main/ets/pages/Index.ets
arkts
futureWeatherView
未来天气组件代码块
@Builder futureWeatherView(){ Scroll(this.scroller) { Row({ space: 15 }) { this.futureWeatherItem('现在', '⛅️', '25°C') this.futureWeatherItem('18时', '☀️️', '26°C') this.futureWeatherItem('19时', '💨️', '22°C') this.futureWeatherItem('20时', '⛅️', '23°C') this.futureWeatherItem('21时', '⛅️', '24°C') this.futureWeatherItem('22时', '⛅️', '22°C') this.futureWeatherItem('23时', '⛅️', '21°C') this.futureWeatherItem('0时', '⛅️', '20°C') } } .width('90%') .scrollable(ScrollDirection.Horizontal) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right futureWeatherView 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#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 15 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . futureWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '现在' AST#expression#Right , AST#expression#Left '⛅️' AST#expression#Right , AST#expression#Left '25°C' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . futureWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '18时' AST#expression#Right , AST#expression#Left '☀️️' AST#expression#Right , AST#expression#Left '26°C' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . futureWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '19时' AST#expression#Right , AST#expression#Left '💨️' AST#expression#Right , AST#expression#Left '22°C' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . futureWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '20时' AST#expression#Right , AST#expression#Left '⛅️' AST#expression#Right , AST#expression#Left '23°C' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . futureWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '21时' AST#expression#Right , AST#expression#Left '⛅️' AST#expression#Right , AST#expression#Left '24°C' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . futureWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '22时' AST#expression#Right , AST#expression#Left '⛅️' AST#expression#Right , AST#expression#Left '22°C' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . futureWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '23时' AST#expression#Right , AST#expression#Left '⛅️' AST#expression#Right , AST#expression#Left '21°C' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . futureWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '0时' AST#expression#Right , AST#expression#Left '⛅️' AST#expression#Right , AST#expression#Left '20°C' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . scrollable ( AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollDirection AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder futureWeatherView(){ Scroll(this.scroller) { Row({ space: 15 }) { this.futureWeatherItem('现在', '⛅️', '25°C') this.futureWeatherItem('18时', '☀️️', '26°C') this.futureWeatherItem('19时', '💨️', '22°C') this.futureWeatherItem('20时', '⛅️', '23°C') this.futureWeatherItem('21时', '⛅️', '24°C') this.futureWeatherItem('22时', '⛅️', '22°C') this.futureWeatherItem('23时', '⛅️', '21°C') this.futureWeatherItem('0时', '⛅️', '20°C') } } .width('90%') .scrollable(ScrollDirection.Horizontal) }
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L46-L62
dbbaff994f96122eab7af916716d2ad4714dc127
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets
arkts
verify2048PKCS1
2048位验签-PKCS1 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey 2048位RSA公钥 @returns 验签结果OutDTO对象,其中Msg为验签结果
static async verify2048PKCS1(signStr: string, verifyStr: string, pubKey: string): Promise<OutDTO<string>> { return CryptoUtil.verify(signStr, verifyStr, pubKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048); }
AST#method_declaration#Left static async verify2048PKCS1 AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . verify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left signStr AST#expression#Right , AST#expression#Left verifyStr AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left 'RSA2048' AST#expression#Right , AST#expression#Left 'RSA2048|PKCS1|SHA256' AST#expression#Right , AST#expression#Left 2048 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async verify2048PKCS1(signStr: string, verifyStr: string, pubKey: string): Promise<OutDTO<string>> { return CryptoUtil.verify(signStr, verifyStr, pubKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L145-L147
2d10737bdaaa52b281e4dfb6804d435826ab3460
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolistautoplay/Index.ets
arkts
VideoListAutoplayComponent
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, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { VideoListAutoplayComponent } from './src/main/ets/view/VideoListAutoplay';
AST#export_declaration#Left export { VideoListAutoplayComponent } from './src/main/ets/view/VideoListAutoplay' ; AST#export_declaration#Right
export { VideoListAutoplayComponent } from './src/main/ets/view/VideoListAutoplay';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/Index.ets#L16-L16
0227f5e2b74b5fb88d2e8033df3bb531fd90db1e
gitee
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/viewmodel/TopicViewModel.ets
arkts
resetPagination
重置分页状态,用于下拉刷新
resetPagination(): void { this.nextPageUrl = null; }
AST#method_declaration#Left resetPagination AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nextPageUrl AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
resetPagination(): void { this.nextPageUrl = null; }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/viewmodel/TopicViewModel.ets#L10-L12
9f914c2454d1fa8e05d6ff50d95319b335e6feef
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/goods/VHGoodsComponent.ets
arkts
getCouponsAvailableHttp
获取可用优惠券列表(核心修复:遍历选中首张满足门槛的优惠券)
getCouponsAvailableHttp() { VHSaaSDK.getInstance() .getCouponAvailableList(this.CouponsWebinarId, { onSucceed: (data) => { this.CouponsAvailable = data || []; this.Index = -1; // 重置为未选中状态 const currentPrice = this.GoodsData.discount_price ?? this.GoodsData.price; // 遍历所有优惠券,选中首张满足“金额≥门槛”的券(支持金额<1) for (let i = 0; i < this.CouponsAvailable.length; i++) { const coupon = this.CouponsAvailable[i]; // 用Math.round统一精度,避免0.9999999999999999误判 if (Math.round(currentPrice * 100) >= Math.round(coupon.threshold_amount * 100)) { this.Index = i; break; } } console.log(`获取可用优惠卷列表成功: ${JSON.stringify(data)},选中索引:${this.Index}`) }, onFailure: (errorCode, errorMsg) => { this.CouponsAvailable = []; this.Index = -1; console.log(`获取可用优惠卷列表失败: ${errorMsg}`) ToastUtil.showToast(`获取可用优惠卷列表失败: ${errorMsg}`); } }); }
AST#method_declaration#Left getCouponsAvailableHttp AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left VHSaaSDK AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getCouponAvailableList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CouponsWebinarId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onSucceed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CouponsAvailable AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Index AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 重置为未选中状态 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentPrice = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . GoodsData AST#member_expression#Right AST#expression#Right . discount_price AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . GoodsData AST#member_expression#Right AST#expression#Right . price AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 遍历所有优惠券,选中首张满足“金额≥门槛”的券(支持金额<1) AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . CouponsAvailable AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left coupon = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CouponsAvailable AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 用Math.round统一精度,避免0.9999999999999999误判 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left currentPrice AST#expression#Right * AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right >= AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left coupon AST#expression#Right . threshold_amount AST#member_expression#Right AST#expression#Right * AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Index AST#member_expression#Right = AST#expression#Left i AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取可用优惠卷列表成功: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ,选中索引: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Index AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailure AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left errorCode AST#parameter#Right , AST#parameter#Left errorMsg AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CouponsAvailable AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Index AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取可用优惠卷列表失败: AST#template_substitution#Left $ { AST#expression#Left errorMsg AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取可用优惠卷列表失败: AST#template_substitution#Left $ { AST#expression#Left errorMsg AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
getCouponsAvailableHttp() { VHSaaSDK.getInstance() .getCouponAvailableList(this.CouponsWebinarId, { onSucceed: (data) => { this.CouponsAvailable = data || []; this.Index = -1; const currentPrice = this.GoodsData.discount_price ?? this.GoodsData.price; for (let i = 0; i < this.CouponsAvailable.length; i++) { const coupon = this.CouponsAvailable[i]; if (Math.round(currentPrice * 100) >= Math.round(coupon.threshold_amount * 100)) { this.Index = i; break; } } console.log(`获取可用优惠卷列表成功: ${JSON.stringify(data)},选中索引:${this.Index}`) }, onFailure: (errorCode, errorMsg) => { this.CouponsAvailable = []; this.Index = -1; console.log(`获取可用优惠卷列表失败: ${errorMsg}`) ToastUtil.showToast(`获取可用优惠卷列表失败: ${errorMsg}`); } }); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/goods/VHGoodsComponent.ets#L935-L960
09561c06a510fc1070c5824c858ec9ce8a31035a
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/utils/ValidatorUtils.ets
arkts
getInputType
判断输入类型
static getInputType(text: string): 'phone' | 'email' | 'unknown' { if (ValidatorUtils.isPhoneNumber(text)) { return 'phone'; } else if (ValidatorUtils.isEmail(text)) { return 'email'; } return 'unknown'; }
AST#method_declaration#Left static getInputType AST#parameter_list#Left ( AST#parameter#Left text : 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 : 'phone' | 'email' | 'unknown' AST#ERROR#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 ValidatorUtils AST#expression#Right . isPhoneNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left text AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 'phone' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ValidatorUtils AST#expression#Right . isEmail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left text AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 'email' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 'unknown' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getInputType(text: string): 'phone' | 'email' | 'unknown' { if (ValidatorUtils.isPhoneNumber(text)) { return 'phone'; } else if (ValidatorUtils.isEmail(text)) { return 'email'; } return 'unknown'; }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/utils/ValidatorUtils.ets#L25-L32
ae2c66629c0da539ca1744389f1e0803997678c7
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/entry/src/main/ets/pages/lifecycle/Lifecycle2View.ets
arkts
Lifecycle2View
@author: HZWei @date: 2024/11/7 @desc:
@Route({ name: RouterConstants.LIFECYCLE2_VIEW }) @Component export struct Lifecycle2View { private hash: number = util.getHash(this) private tag: string = `LifecycleMgr ${RouterConstants.LIFECYCLE2_VIEW} ${this.hash}: ` // 1、初始化生命周期注册对象,并使用@Lifecycle修饰 @Lifecycle lifecycle: LifecycleRegistry = LifecycleRegistry.create(this); @State counter: number = 0 aboutToAppear(): void { // 2、使用addObserver设置生命周期函数监听 // 注意:如果addObserver是字面量对象注册的情况,将this设置局部变量,不然在对象内的this指向会不对 let that = this this.lifecycle.addObserver<ILifecycleObserver>({ aboutToAppear: () => { console.log(`${that.tag}aboutToAppear`) }, onPageShow() { console.log(`${that.tag}onPageShow`) }, onPageHide() { console.log(`${that.tag}onPageHide`) }, aboutToDisappear: () => { console.log(`${that.tag}aboutToDisappear`) }, onWillAppear(r) { console.log(`${that.tag}onWillAppear`,r?.name, r?.navDestinationId) }, onAppear(r) { console.log(`${that.tag}onAppear`, r?.name, r?.navDestinationId) that.counter++ }, onShown(r) { console.log(`${that.tag}onShown `,r?.name, r?.navDestinationId) }, onHidden(r) { console.log(`${that.tag}onHidden `, r?.name, r?.navDestinationId) }, onWillDisappear(r) { console.log(`${that.tag}onWillDisappear `,r?.name, r?.navDestinationId) }, onDisappear(r) { console.log(`${that.tag}onDisappear `, r?.name, r?.navDestinationId) } }) }
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 RouterConstants AST#expression#Right . LIFECYCLE2_VIEW AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Lifecycle2View AST#component_body#Left { AST#property_declaration#Left private hash : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . getHash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left ` LifecycleMgr AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left RouterConstants AST#expression#Right . LIFECYCLE2_VIEW AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hash AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : ` AST#template_literal#Right AST#expression#Right // 1、初始化生命周期注册对象,并使用@Lifecycle修饰 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Lifecycle AST#decorator#Right lifecycle : AST#type_annotation#Left AST#primary_type#Left LifecycleRegistry AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LifecycleRegistry AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right counter : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 0 AST#expression#Right AST#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#ERROR#Right void { // 2、使用addObserver设置生命周期函数监听 // 注意:如果addObserver是字面量对象注册的情况,将this设置局部变量,不然在对象内的this指向会不对 AST#property_name#Left let AST#property_name#Right that AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . lifecycle AST#member_expression#Right AST#expression#Right . addObserver AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ILifecycleObserver AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left aboutToAppear AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right aboutToAppear ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onPageShow AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right onPageShow ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onPageHide AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right onPageHide ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left aboutToDisappear AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right aboutToDisappear ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onWillAppear AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left r AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right onWillAppear ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. navDestinationId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAppear AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left r AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right onAppear ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. navDestinationId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . counter AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onShown AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left r AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right onShown ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. navDestinationId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onHidden AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left r AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right onHidden ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. navDestinationId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onWillDisappear AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left r AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right onWillDisappear ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. navDestinationId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onDisappear AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left r AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left that AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right onDisappear ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. navDestinationId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Route({ name: RouterConstants.LIFECYCLE2_VIEW }) @Component export struct Lifecycle2View { private hash: number = util.getHash(this) private tag: string = `LifecycleMgr ${RouterConstants.LIFECYCLE2_VIEW} ${this.hash}: ` @Lifecycle lifecycle: LifecycleRegistry = LifecycleRegistry.create(this); @State counter: number = 0 aboutToAppear(): void { let that = this this.lifecycle.addObserver<ILifecycleObserver>({ aboutToAppear: () => { console.log(`${that.tag}aboutToAppear`) }, onPageShow() { console.log(`${that.tag}onPageShow`) }, onPageHide() { console.log(`${that.tag}onPageHide`) }, aboutToDisappear: () => { console.log(`${that.tag}aboutToDisappear`) }, onWillAppear(r) { console.log(`${that.tag}onWillAppear`,r?.name, r?.navDestinationId) }, onAppear(r) { console.log(`${that.tag}onAppear`, r?.name, r?.navDestinationId) that.counter++ }, onShown(r) { console.log(`${that.tag}onShown `,r?.name, r?.navDestinationId) }, onHidden(r) { console.log(`${that.tag}onHidden `, r?.name, r?.navDestinationId) }, onWillDisappear(r) { console.log(`${that.tag}onWillDisappear `,r?.name, r?.navDestinationId) }, onDisappear(r) { console.log(`${that.tag}onDisappear `, r?.name, r?.navDestinationId) } }) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/lifecycle/Lifecycle2View.ets#L11-L59
d7107dc715cf2373825d32b1e90b012ca615625e
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineDataSet.ets
arkts
isDrawSteppedEnabled
@Deprecated
public isDrawSteppedEnabled(): boolean { return this.mMode == Mode.STEPPED; }
AST#method_declaration#Left public isDrawSteppedEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMode AST#member_expression#Right AST#expression#Right == AST#expression#Left Mode AST#expression#Right AST#binary_expression#Right AST#expression#Right . STEPPED AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public isDrawSteppedEnabled(): boolean { return this.mMode == Mode.STEPPED; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L249-L251
c6456d6b198744167dc400a41b1b60ac6160e1d3
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
isTransparent
窗口是否透明。默认为false。true表示透明;false表示不透明。 @param windowClass 不传该值,默认主窗口。 @returns
static isTransparent(windowClass: window.Window = AppUtil.getMainWindow()): boolean { return WindowUtil.getWindowProperties(windowClass).isTransparent; }
AST#method_declaration#Left static isTransparent AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getMainWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WindowUtil AST#expression#Right . getWindowProperties AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left windowClass AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . isTransparent AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isTransparent(windowClass: window.Window = AppUtil.getMainWindow()): boolean { return WindowUtil.getWindowProperties(windowClass).isTransparent; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L355-L357
1c02f4a73a9d055ded14a5ff88e048c60eb4a5f7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
strToBuffer
字符串转ArrayBuffer @param str @returns
static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer { const buf = buffer.from(src, encoding); return buf.buffer; }
AST#method_declaration#Left static strToBuffer AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left encoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'utf-8' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left buf = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left src AST#expression#Right , AST#expression#Left encoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left buf AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer { const buf = buffer.from(src, encoding); return buf.buffer; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L336-L339
c175b4be32ac966140455ccc5daea4ebe2a231e2
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/userModel.ets
arkts
loadUsers
从 Preferences 中加载所有用户到 userData 数组
async loadUsers() { try { const usersStr = (await preference.get(CommonConstants.KEY_NAME, '[]')).toString(); this.userData = JSON.parse(usersStr); Logger.info(CommonConstants.TAG, `Loaded ${this.userData.length} users.`); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to load todos, Cause: ${err}`); this.userData = []; // 如果加载失败,确保 ToDoData 为空数组 } }
AST#method_declaration#Left async loadUsers 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#variable_declaration#Left const AST#variable_declarator#Left usersStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left preference AST#expression#Right AST#await_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . KEY_NAME AST#member_expression#Right AST#expression#Right , AST#expression#Left '[]' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userData AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left usersStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Loaded AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userData AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right users. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to load todos, Cause: AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userData AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 如果加载失败,确保 ToDoData 为空数组 } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async loadUsers() { try { const usersStr = (await preference.get(CommonConstants.KEY_NAME, '[]')).toString(); this.userData = JSON.parse(usersStr); Logger.info(CommonConstants.TAG, `Loaded ${this.userData.length} users.`); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to load todos, Cause: ${err}`); this.userData = []; } }
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L47-L56
f1fd3a62ea286a43674f92311b6c55e783c1d74c
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
onTouchStart
Touch start. @param x @param y
onTouchStart(x: number, y: number): void { if (this.state !== CropTouchState.NONE) { Logger.debug(TAG, 'onTouchStart: touch state is not none!'); return; } if (this.isWaitingRefresh) { this.clearDelayRefresh(); } Logger.debug(TAG, `onTouchStart: [x: ${x}, y: ${y}]`); if (this.cropShow.isCropRectTouch(x, y)) { this.state = CropTouchState.CROP_MOVE; } else { this.state = CropTouchState.IMAGE_DRAG; } this.splitLineShow = true; this.touchPoint.set(x, y); }
AST#method_declaration#Left onTouchStart AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . state AST#member_expression#Right AST#expression#Right !== AST#expression#Left CropTouchState AST#expression#Right AST#binary_expression#Right AST#expression#Right . NONE AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'onTouchStart: touch state is not none!' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isWaitingRefresh AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clearDelayRefresh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` onTouchStart: [x: AST#template_substitution#Left $ { AST#expression#Left x AST#expression#Right } AST#template_substitution#Right , y: AST#template_substitution#Left $ { AST#expression#Left y AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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#expression#Left this AST#expression#Right . cropShow AST#member_expression#Right AST#expression#Right . isCropRectTouch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . state AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CropTouchState AST#expression#Right . CROP_MOVE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . state AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CropTouchState AST#expression#Right . IMAGE_DRAG AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . splitLineShow AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . touchPoint AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
onTouchStart(x: number, y: number): void { if (this.state !== CropTouchState.NONE) { Logger.debug(TAG, 'onTouchStart: touch state is not none!'); return; } if (this.isWaitingRefresh) { this.clearDelayRefresh(); } Logger.debug(TAG, `onTouchStart: [x: ${x}, y: ${y}]`); if (this.cropShow.isCropRectTouch(x, y)) { this.state = CropTouchState.CROP_MOVE; } else { this.state = CropTouchState.IMAGE_DRAG; } this.splitLineShow = true; this.touchPoint.set(x, y); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L212-L230
3217da589f6f0a7b7af53ac74a6fc4d9b7d7a11f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringEncrypt.ets
arkts
decodedFromBase64
将Base64字符串解码 @param str Base64编码的字符串 @returns 解码后的原始字符串或null
static decodedFromBase64(str: string | null): string | null { return new Base64Encoder(str).decodedString(); }
AST#method_declaration#Left static decodedFromBase64 AST#parameter_list#Left ( AST#parameter#Left str : 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#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : 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#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Base64Encoder AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . decodedString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static decodedFromBase64(str: string | null): string | null { return new Base64Encoder(str).decodedString(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L24-L26
dc732444800a77f8d895d9f807518a751e65c0d6
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/array_lib_func_004_F.ets
arkts
Introduction 库函数-array_pop
export function array_lib_func_004_F(taint_src : string) { let arr : string[] = ["a","b","_"]; let t = arr.pop(); taint.Sink(t!); }
AST#export_declaration#Left export AST#function_declaration#Left function array_lib_func_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left arr : 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#expression#Left AST#array_literal#Left [ AST#expression#Left "a" AST#expression#Right , AST#expression#Left "b" AST#expression#Right , AST#expression#Left "_" AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left t = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left t AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function array_lib_func_004_F(taint_src : string) { let arr : string[] = ["a","b","_"]; let t = arr.pop(); taint.Sink(t!); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/array_lib_func_004_F.ets#L6-L10
6835d3d2562fbd9f5590c15a6aee82e50e3b451c
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/ui/animation/AnimationUtils.ets
arkts
fade
淡入淡出转场配置
static fade(): PageTransitionConfig { return { duration: 300, curve: curve.EaseOut }; }
AST#method_declaration#Left static fade AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PageTransitionConfig 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#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left curve AST#expression#Right . EaseOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static fade(): PageTransitionConfig { return { duration: 300, curve: curve.EaseOut }; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L85-L90
848ad339ef68eec4e7da50156bcdf6f6843ac66e
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/models/ThemeModel.ets
arkts
loadSavedTheme
加载保存的主题设置
private async loadSavedTheme(): Promise<void> { try { // TODO: 从持久化存储中加载主题设置 // const savedThemeType = await StorageUtils.getString(ThemeManager.STORAGE_KEY); // if (savedThemeType && Object.values(ThemeType).includes(savedThemeType as ThemeType)) { // const theme = THEME_CONFIGS.find(t => t.type === savedThemeType); // if (theme) { // this.currentTheme = theme; // return; // } // } } catch (error) { console.error('Failed to load saved theme:', error); } // 默认使用简约主题 this.currentTheme = THEME_CONFIGS[0]; }
AST#method_declaration#Left private async loadSavedTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // TODO: 从持久化存储中加载主题设置 // const savedThemeType = await StorageUtils.getString(ThemeManager.STORAGE_KEY); // if (savedThemeType && Object.values(ThemeType).includes(savedThemeType as ThemeType)) { // const theme = THEME_CONFIGS.find(t => t.type === savedThemeType); // if (theme) { // this.currentTheme = theme; // return; // } // } } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Failed to load saved theme:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right // 默认使用简约主题 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTheme AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left THEME_CONFIGS AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async loadSavedTheme(): Promise<void> { try { } catch (error) { console.error('Failed to load saved theme:', error); } this.currentTheme = THEME_CONFIGS[0]; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L163-L180
fd6644a0196dd9166cbc8c17d91379e2944aaeca
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WantUtil.ets
arkts
toNotificationSetting
跳转通知设置页面
static toNotificationSetting(): Promise<void> { const parameters: Record<string, Record<string, string>> = { 'pushParams': { 'bundleName': AppUtil.getContext().abilityInfo.bundleName // 应用包名 } }; return WantUtil.toSetting(WantUtil.URI_NOTIFICATION,parameters); }
AST#method_declaration#Left static toNotificationSetting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left parameters : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'pushParams' AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'bundleName' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right // 应用包名 } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WantUtil AST#expression#Right . toSetting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left WantUtil AST#expression#Right . URI_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left parameters AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static toNotificationSetting(): Promise<void> { const parameters: Record<string, Record<string, string>> = { 'pushParams': { 'bundleName': AppUtil.getContext().abilityInfo.bundleName } }; return WantUtil.toSetting(WantUtil.URI_NOTIFICATION,parameters); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L118-L125
2f8231ce70c211550f89f6fbe879097ff92779f6
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SegmentButtonV2.d.ets
arkts
The callback function that will be invoked when the selectedIndex of the segmented button is changed. @typedef { function } OnSelectedIndexChange @param { number } selectedIndex - the index of selected item @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export type OnSelectedIndexChange = (selectedIndex: number) => void;
AST#export_declaration#Left export AST#type_declaration#Left type OnSelectedIndexChange = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left selectedIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
export type OnSelectedIndexChange = (selectedIndex: number) => void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButtonV2.d.ets#L157-L157
dc716d0dd13156e51f941ed14657c9920dd32979
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
isDefaultNetMetered
检查当前网络上的数据流量使用是否被计量 @returns
static async isDefaultNetMetered(): Promise<boolean> { return connection.isDefaultNetMetered(); }
AST#method_declaration#Left static async isDefaultNetMetered 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . isDefaultNetMetered AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async isDefaultNetMetered(): Promise<boolean> { return connection.isDefaultNetMetered(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L37-L39
d1453549d53fdeceae09c78074440e45520618e6
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
用户模型
export interface User { id: number; username: string; nickname: string; avatar: string; email?: string; bio?: string; followersCount?: number; followingCount?: number; createdAt?: string; isFollowed?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface User 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#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left nickname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left avatar : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left email ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left bio ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left followersCount ? : 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 followingCount ? : 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 createdAt ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isFollowed ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface User { id: number; username: string; nickname: string; avatar: string; email?: string; bio?: string; followersCount?: number; followingCount?: number; createdAt?: string; isFollowed?: boolean; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L149-L160
4b08eacf593a67212701a5eb84a7ca2667911f0c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/model/DialogOptions.ets
arkts
TODO 输入弹出框,参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export class InputOptions extends BaseContentOptions { inputType?: InputType; //输入框类型。默认值:InputType.Normal showPassword?: boolean; //是否显示密码(inputType为InputType.Password起作用) showPasswordIcon?: boolean; //是否显示密码图标(inputType为InputType.Password起作用) passwordIcon?: PasswordIcon; //设置当密码输入模式时,输入框末尾的图标。支持jpg、png、bmp、heic和webp类型的图片格式。 passwordRules?: string; //定义生成密码的规则。在触发自动填充时,所设置的密码规则会透传给密码保险箱,用于新密码的生成。 cancelButton?: CancelButtonOptions; //设置右侧清除按钮样式。 text: string = ""; //设置输入框当前的文本内容。 fontColor?: ResourceColor; //字体颜色 fontSize?: Length; //字体大小 placeholder?: ResourceStr; //设置无输入时的提示文本。 placeholderColor ?: ResourceColor //设置placeholder文本颜色。 inputBackgroundColor?: ResourceColor; //输入框背景 inputBorder?: BorderOptions; //输入框Border inputHeight?: Length; //输入框高度 defaultFocus?: boolean //设置弹框默认获得焦点,打开弹窗同时弹出输入法 maxLength?: number; //文本的最大输入字符数。 默认值:Infinity,可以无限输入。 buttons?: Array<ButtonOptions>; //弹出框操作区按钮,最多支持4个按钮。 }
AST#export_declaration#Left export AST#class_declaration#Left class InputOptions extends AST#type_annotation#Left AST#primary_type#Left BaseContentOptions AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left inputType ? : AST#type_annotation#Left AST#primary_type#Left InputType AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //输入框类型。默认值:InputType.Normal AST#property_declaration#Left showPassword ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //是否显示密码(inputType为InputType.Password起作用) AST#property_declaration#Left showPasswordIcon ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //是否显示密码图标(inputType为InputType.Password起作用) AST#property_declaration#Left passwordIcon ? : AST#type_annotation#Left AST#primary_type#Left PasswordIcon AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //设置当密码输入模式时,输入框末尾的图标。支持jpg、png、bmp、heic和webp类型的图片格式。 AST#property_declaration#Left passwordRules ? : 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 cancelButton ? : AST#type_annotation#Left AST#primary_type#Left CancelButtonOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //设置右侧清除按钮样式。 AST#property_declaration#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right //设置输入框当前的文本内容。 AST#property_declaration#Left fontColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //字体颜色 AST#property_declaration#Left fontSize ? : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //字体大小 AST#property_declaration#Left placeholder ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //设置无输入时的提示文本。 AST#property_declaration#Left placeholderColor AST#ERROR#Left ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right //设置placeholder文本颜色。 AST#ERROR#Left in putBackgroundColor AST#ERROR#Right ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //输入框背景 AST#property_declaration#Left inputBorder ? : AST#type_annotation#Left AST#primary_type#Left BorderOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //输入框Border AST#property_declaration#Left inputHeight ? : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //输入框高度 AST#property_declaration#Left defaultFocus ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right //设置弹框默认获得焦点,打开弹窗同时弹出输入法 AST#ERROR#Left maxLength ? : number AST#ERROR#Right ; AST#property_declaration#Right //文本的最大输入字符数。 默认值:Infinity,可以无限输入。 AST#property_declaration#Left buttons ? : 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 ButtonOptions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //弹出框操作区按钮,最多支持4个按钮。 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class InputOptions extends BaseContentOptions { inputType?: InputType; showPassword?: boolean; showPasswordIcon?: boolean; passwordIcon?: PasswordIcon; passwordRules?: string; cancelButton?: CancelButtonOptions; text: string = ""; fontColor?: ResourceColor; fontSize?: Length; placeholder?: ResourceStr; placeholderColor ?: ResourceColor inputBackgroundColor?: ResourceColor; inputBorder?: BorderOptions; inputHeight?: Length; defaultFocus?: boolean maxLength?: number; buttons?: Array<ButtonOptions>; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/model/DialogOptions.ets#L116-L136
b74bf846d8a3902fa2b99d12d91edd107ded580b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets
arkts
onlyGroupUpdateName
校验唯一性,同时进行更新
async onlyGroupUpdateName(newName: string, id: number) { return await BookGroupsDao.onlyGroupUpdateName(id,newName) }
AST#method_declaration#Left async onlyGroupUpdateName AST#parameter_list#Left ( AST#parameter#Left newName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left BookGroupsDao AST#expression#Right AST#await_expression#Right AST#expression#Right . onlyGroupUpdateName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right , AST#expression#Left newName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async onlyGroupUpdateName(newName: string, id: number) { return await BookGroupsDao.onlyGroupUpdateName(id,newName) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets#L13-L15
5520d3e7c86517beb81fc76d14fa337a9978b691
github
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/common/bean/FarmBean.ets
arkts
save_db
--------------------json转化部分(finished)------------------// 废弃,生成一个test+farmId.json的json文件用于存储农田信息,在FarmBean文件夹下 Json_save(){ let context = getContext(this) as common.UIAbilityContext; let filesDir = context.filesDir; let filenames : string[]; let dirPath_cache = filesDir + '/FarmBean'; fs.access(dirPath_cache).then((res) => { if (res) { 获取文件夹内所有内容 let filepath = filesDir+"/FarmBean"+'/test'+this.fieldId.toString()+'.json'; let file = fs.openSync(filepath,fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); console.info(filesDir+"/FarmBean"+'/test'+this.fieldId.toString()+'.json'); let message = fs.writeSync(file.fd, f2.to_JSON()); fs.writeSync(file.fd, this.to_JSON()); console.info("The length of str is: " + message+"and main is"+f2.to_JSON()); console.info('data has been loaded'); return true; } }).catch((err) => { console.error("access failed with error message: " + err.message + ", error code: " + err.code); }); } --------------------数据库操作部分(finished)------------------//
save_db(){ DistributedUtil.putStoreData(this.fieldId.toString(),this.to_JSON()); console.info('successfully save in db') }
AST#method_declaration#Left save_db 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 DistributedUtil AST#expression#Right . putStoreData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fieldId AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . to_JSON AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'successfully save in db' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
save_db(){ DistributedUtil.putStoreData(this.fieldId.toString(),this.to_JSON()); console.info('successfully save in db') }
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/common/bean/FarmBean.ets#L127-L130
9c48c4bc248908186c725cb5fc35efdb4ffedc2d
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
countNonEmpty
统计非空消息数量 @param messages 消息数组 @returns 非空消息的数量 使用示例: ```typescript const people = [person1, emptyPerson, person3] const nonEmptyCount = MessageUtils.countNonEmpty(people) // nonEmptyCount: 2 ```
static countNonEmpty<T extends Message>(messages: T[]): number { return messages.filter(m => !m.isEmpty()).length }
AST#method_declaration#Left static countNonEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right 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_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left m AST#expression#Right AST#unary_expression#Right AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static countNonEmpty<T extends Message>(messages: T[]): number { return messages.filter(m => !m.isEmpty()).length }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L364-L366
2eaa5efe007031d9f333660b5a9f874600a0afb5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets
arkts
clipIfNeedsFull
/对于太长的翻译,截取指定长度[按“;”分隔]的 部分
public static clipIfNeedsFull( srcStr: string | null, seperator: string, subSeperator: string, maxParts: number ): string | null { if (srcStr === null) { return null; } const tempList: Array<string> = []; return StringDealUtilityForBaseWord.dealInternal( srcStr, seperator, subSeperator, (partStr: string) => { const s = partStr.trim(); if (s.length > 0 && tempList.length < maxParts) { tempList.push(s); return s; //判断重复 } return null; } ); }
AST#method_declaration#Left public static clipIfNeedsFull AST#parameter_list#Left ( AST#parameter#Left srcStr : 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#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left subSeperator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxParts : 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#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left srcStr AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempList : 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_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringDealUtilityForBaseWord AST#expression#Right . dealInternal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcStr AST#expression#Right , AST#expression#Left seperator AST#expression#Right , AST#expression#Left subSeperator AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left partStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left s = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left partStr AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left tempList AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left maxParts AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tempList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left s AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left s AST#expression#Right ; AST#return_statement#Right AST#statement#Right //判断重复 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static clipIfNeedsFull( srcStr: string | null, seperator: string, subSeperator: string, maxParts: number ): string | null { if (srcStr === null) { return null; } const tempList: Array<string> = []; return StringDealUtilityForBaseWord.dealInternal( srcStr, seperator, subSeperator, (partStr: string) => { const s = partStr.trim(); if (s.length > 0 && tempList.length < maxParts) { tempList.push(s); return s; } return null; } ); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets#L98-L124
240af357dc8e8126ef335cbad95a2beb783f0f2e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
Fits tools with different sizes and lengths.
export default class DimensionUtil { /** * Obtains the screen horizontal adaptation value. * * @return number */ static adaptDimension(value: number): number { let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN_HEIGHT * DESIGN_HEIGHT); let virtualDim = Math.sqrt(deviceDisplay.width * deviceDisplay.width + virtualHeight * virtualHeight); return virtualDim * value / designDim; // 放缩后长度 } /** * Obtains the screen horizontal adaptation px. * * @return number */ static getPx(value: Resource): number { let beforeVp = context.resourceManager.getNumber(value.id); return DimensionUtil.adaptDimension(beforeVp); } /** * Obtains the screen horizontal adaptation vp. * * @return number */ static getVp(value: Resource): number { let beforeVp = context.resourceManager.getNumber(value.id); return px2vp(DimensionUtil.adaptDimension(beforeVp)); } /** * Obtains the screen horizontal adaptation fp. * * @return number */ static getFp(value: Resource): number { let beforeFp = context.resourceManager.getNumber(value.id); return px2fp(DimensionUtil.adaptDimension(beforeFp)); } }
AST#export_declaration#Left export default AST#class_declaration#Left class DimensionUtil AST#class_body#Left { /** * Obtains the screen horizontal adaptation value. * * @return number */ AST#method_declaration#Left static adaptDimension AST#parameter_list#Left ( AST#parameter#Left value : 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_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left deviceDisplay = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'globalDisplay' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Display AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left widthScale = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left deviceDisplay AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left DESIGN_WIDTH AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left virtualHeight = AST#expression#Left AST#binary_expression#Left AST#expression#Left widthScale AST#expression#Right * AST#expression#Left DESIGN_HEIGHT AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left designDim = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . sqrt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left DESIGN_WIDTH AST#expression#Right * AST#expression#Left DESIGN_WIDTH AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left DESIGN_HEIGHT AST#expression#Right * AST#expression#Left DESIGN_HEIGHT AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left virtualDim = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . sqrt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left deviceDisplay AST#expression#Right . width AST#member_expression#Right AST#expression#Right * AST#expression#Left deviceDisplay AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left virtualHeight AST#expression#Right * AST#expression#Left virtualHeight AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left virtualDim AST#expression#Right * AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left designDim AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 放缩后长度 } AST#block_statement#Right AST#method_declaration#Right /** * Obtains the screen horizontal adaptation px. * * @return number */ AST#method_declaration#Left static getPx AST#parameter_list#Left ( AST#parameter#Left value : 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 number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left beforeVp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . adaptDimension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left beforeVp AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Obtains the screen horizontal adaptation vp. * * @return number */ AST#method_declaration#Left static getVp AST#parameter_list#Left ( AST#parameter#Left value : 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 number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left beforeVp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . adaptDimension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left beforeVp AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Obtains the screen horizontal adaptation fp. * * @return number */ AST#method_declaration#Left static getFp AST#parameter_list#Left ( AST#parameter#Left value : 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 number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left beforeFp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left px2fp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . adaptDimension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left beforeFp AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class DimensionUtil { static adaptDimension(value: number): number { let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN_HEIGHT * DESIGN_HEIGHT); let virtualDim = Math.sqrt(deviceDisplay.width * deviceDisplay.width + virtualHeight * virtualHeight); return virtualDim * value / designDim; } static getPx(value: Resource): number { let beforeVp = context.resourceManager.getNumber(value.id); return DimensionUtil.adaptDimension(beforeVp); } static getVp(value: Resource): number { let beforeVp = context.resourceManager.getNumber(value.id); return px2vp(DimensionUtil.adaptDimension(beforeVp)); } static getFp(value: Resource): number { let beforeFp = context.resourceManager.getNumber(value.id); return px2fp(DimensionUtil.adaptDimension(beforeFp)); } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets#L33-L77
bafd26ce55753d82aee56c752b0b8819b8fabc87
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/select/Cascade.ets
arkts
Cascade
@Author csx @DateTime 2024/3/26 10:02:02 @TODO Cascade 级联选择器 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
@Component export struct Cascade { //反会给上一级的数据 @Link callCity: string //是否显示 @Link show: boolean //显示城市 @State private showCity: boolean = false //显示区域 @State private showArea: boolean = false private provinceList: Array<City> = new Array(); //点击选择的数据 @State private selectData: cascadeCity = new cascadeCity(); //当前list显示的数据 @State private currentList: Array<City> = new Array(); //当前省市区选择的下标 @State private selectIndex: number = 0; //顶部已选择省市区字体大小 @State titleFontSize: number | string = UiConst.FONT_16; aboutToAppear() { if (this.provinceList.length == 0) { this.init(); } } /** * 初始化城市数据 */ private init() { try { //获取区域数据 let jsonStr = getContext().resourceManager.getRawFileContentSync("area.json"); //转码 let textCoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); let vStr = textCoder.decodeWithStream(jsonStr, { stream: false }); //获取数据 this.provinceList = JSON.parse(vStr) as Array<City>; this.provinceList.forEach(province => { //默认将省数据赋值给当前listview对应的数据 this.currentList.push(new City(province.name, province.code)); }) } catch (error) { let code = (error as BusinessError).code; let message = (error as BusinessError).message; ToastUtil.showToast(`获取区域数据出错, 错误编码: ${code}, 原因: ${message}.`); } } /** * 获取城市数据 * @param prevCode 省code * @returns */ private getCityData(prevCode: string): Array<City> { return (this.provinceList.filter((pro: City) => pro.code == prevCode).pop() as City).children; } /** * 获取区县数据 * @param prevCode 省code * @param cityCode 市code * @returns */ private getAreaData(prevCode: string, cityCode: string): Array<City> { return ((this.provinceList.filter((pro: City) => pro.code == prevCode) .pop() as City).children.filter((city: City) => city.code == cityCode).pop() as City).children; } /** * 重置数据 */ private reset() { this.show = !this.show; this.showCity = false; this.showArea = false; this.selectData = new cascadeCity(); this.currentList = new Array(); this.selectIndex = 0; this.currentList = this.getProvinceData(); } /** * 获取省数据 * @returns */ private getProvinceData(): Array<City> { let provList: Array<City> = new Array(); this.provinceList.forEach(province => { //默认将省数据赋值给当前listview对应的数据 provList.push(new City(province.name, province.code)); }) return provList; } build() { Panel(this.show) { //顶部 Column() { Row() { Text('请选择地区').fontWeight('bold').fontSize(UiConst.FONT_16) Image(getContext().resourceManager.getMediaBase64ByNameSync("close")) .width(UiConst.VP_15) .height(UiConst.VP_15) .onClick(() => { this.reset() }) } .width('100%') .padding({ top: UiConst.NUMBER_15, left: UiConst.NUMBER_20, right: UiConst.NUMBER_25, bottom: UiConst.NUMBER_10 }) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.SpaceBetween) } //中部选择区域 Row() { //省市区 Column() { if (this.selectIndex == 0 && !this.selectData.provinceName) { Text("请选择").txtColor(true, this.titleFontSize) Text(" ").cascadeUnderLine(true) } else { Text(this.selectData.provinceName).txtColor(false, this.titleFontSize).onClick(() => { this.selectIndex = 0; this.currentList = this.getProvinceData(); }) Text(" ").cascadeUnderLine(this.selectIndex == 0) } }.margin({ right: UiConst.NUMBER_20 }) //市 if (this.showCity) { Column() { if (this.selectIndex === 1 && !this.selectData.cityName) { Text("请选择").txtColor(true, this.titleFontSize) Text(" ").cascadeUnderLine(true) } else { Text(this.selectData.cityName).txtColor(false, this.titleFontSize).onClick(() => { this.selectIndex = 1; this.currentList = this.getCityData(this.selectData.provinceCode); }) Text(" ").cascadeUnderLine(this.selectIndex == 1) } }.margin({ right: UiConst.NUMBER_20 }) } //区 if (this.showArea) { //区域 Column() { if (this.selectIndex === 2 && !this.selectData.areaName) { Text("请选择").txtColor(true, this.titleFontSize) Text(" ").cascadeUnderLine(true) } else { Text(this.selectData.areaName).txtColor(false, this.titleFontSize).onClick(() => { this.selectIndex = 2; this.currentList = this.getAreaData(this.selectData.provinceCode, this.selectData.cityCode); }) Text(" ").cascadeUnderLine(this.selectIndex == 2) } } } } .width("100%") .margin({ top: UiConst.NUMBER_10, left: UiConst.VP_35 }) .justifyContent(FlexAlign.Start) .alignItems(VerticalAlign.Center) Row() { List({ space: UiConst.NUMBER_5, initialIndex: 0 }) { ForEach(this.currentList, (item: City) => { ListItem() { Row() { if (this.selectIndex === 0) { Text(item.name) .cityTxtColor() .fontColor(item.code == this.selectData.provinceCode ? "#1989fa" : "#323233") if (item.code == this.selectData.provinceCode) { Image(getContext().resourceManager.getMediaBase64ByNameSync("ok")).width(UiConst.VP_15).height(UiConst.VP_15) } } if (this.selectIndex === 1) { Text(item.name) .cityTxtColor() .fontColor(item.code == this.selectData.cityCode ? "#1989fa" : "#323233") if (item.code == this.selectData.cityCode) { Image(getContext().resourceManager.getMediaBase64ByNameSync("ok")).width(UiConst.VP_15).height(UiConst.VP_15) } } if (this.selectIndex === 2) { Text(item.name) .cityTxtColor() .fontColor(item.code == this.selectData.areaCode ? "#1989fa" : "#323233") if (item.code == this.selectData.areaCode) { Image(getContext().resourceManager.getMediaBase64ByNameSync("ok")).width(UiConst.VP_15).height(UiConst.VP_15) } } } .width("100%") .justifyContent(FlexAlign.SpaceBetween) .alignItems(VerticalAlign.Center) .padding({ right: UiConst.NUMBER_20 }) } .margin({ top: UiConst.NUMBER_5, bottom: UiConst.NUMBER_5 }) .onClick(() => { //点击赋值选中的数据 if (this.selectIndex === 0) { this.selectData.provinceName = item.name; this.selectData.provinceCode = item.code; this.selectData.cityCode = ""; this.selectData.cityName = ""; this.selectData.areaCode = ""; this.selectData.areaName = ""; this.showCity = true; setTimeout(() => { this.currentList = this.getCityData(item.code); this.selectIndex = 1; }, 200) } if (this.selectIndex === 1) { this.selectData.cityName = item.name; this.selectData.cityCode = item.code; this.selectData.areaCode = ""; this.selectData.areaName = ""; this.showArea = true; setTimeout(() => { this.currentList = this.getAreaData(this.selectData.provinceCode, item.code); this.selectIndex = 2; }, 200) } if (this.selectIndex === 2) { this.selectData.areaName = item.name; this.selectData.areaCode = item.code; //赋值 this.callCity = this.selectData.provinceName + "/" + this.selectData.cityName + "/" + this.selectData.areaName; //赋值后初始化数据 this.reset() } }) }, (item: City) => item.code) } .listDirection(Axis.Vertical) // 排列方向 .edgeEffect(EdgeEffect.None) .width('100%') .scrollBar(BarState.Auto) .scrollBarWidth(UiConst.NUMBER_3) .scrollBarColor(UiConst.PRIMARY_COLOR) .padding({ bottom: UiConst.NUMBER_10 }) } .height('100%') .width("100%") .alignItems(VerticalAlign.Top) .padding({ left: UiConst.NUMBER_20 }) } .type(PanelType.CUSTOM) .dragBar(false) .height(PanelHeight.WRAP_CONTENT) .customHeight(600) // .backgroundColor("#22000000") // .backgroundMask(UiConst.DIALOG_CANCEL_COLOR) .position({ x: 0, y: 0 }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Cascade AST#component_body#Left { //反会给上一级的数据 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right callCity : 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 AST#decorator#Left @ Link AST#decorator#Right show : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right //显示城市 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private showCity : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right //显示区域 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private showArea : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private provinceList : 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 City AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right //点击选择的数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private selectData : AST#type_annotation#Left AST#primary_type#Left cascadeCity AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left cascadeCity AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right //当前list显示的数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private currentList : 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 City AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right //当前省市区选择的下标 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private selectIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right //顶部已选择省市区字体大小 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right titleFontSize : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . FONT_16 AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 初始化城市数据 */ AST#method_declaration#Left private init 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#variable_declaration#Left let AST#variable_declarator#Left jsonStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getRawFileContentSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "area.json" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转码 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left textCoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . TextDecoder AST#member_expression#Right AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'utf-8' AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left ignoreBOM AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left vStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textCoder AST#expression#Right . decodeWithStream AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left jsonStr AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left stream AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //获取数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceList AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left vStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as 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 City AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceList AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left province => AST#block_statement#Left { //默认将省数据赋值给当前listview对应的数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left City AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left code = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取区域数据出错, 错误编码: AST#template_substitution#Left $ { AST#expression#Left code AST#expression#Right } AST#template_substitution#Right , 原因: AST#template_substitution#Left $ { AST#expression#Left message AST#expression#Right } AST#template_substitution#Right . ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取城市数据 * @param prevCode 省code * @returns */ AST#method_declaration#Left private getCityData AST#parameter_list#Left ( AST#parameter#Left prevCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceList AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left pro : AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pro AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left prevCode AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . children AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取区县数据 * @param prevCode 省code * @param cityCode 市code * @returns */ AST#method_declaration#Left private getAreaData AST#parameter_list#Left ( AST#parameter#Left prevCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cityCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceList AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left pro : AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pro AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left prevCode AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . children AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left city : AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left cityCode AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . children AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 重置数据 */ AST#method_declaration#Left private reset AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . show AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showCity AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showArea AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left cascadeCity AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getProvinceData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 获取省数据 * @returns */ AST#method_declaration#Left private getProvinceData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left provList : 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 City AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . provinceList AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left province => AST#block_statement#Left { //默认将省数据赋值给当前listview对应的数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left provList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left City AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . name AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left provList AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Panel ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . show AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { //顶部 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '请选择地区' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 'bold' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . FONT_16 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaBase64ByNameSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "close" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_15 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_20 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_25 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_10 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //中部选择区域 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { //省市区 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceName AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "请选择" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . txtColor ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left " " AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cascadeUnderLine ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . txtColor ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getProvinceData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left " " AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cascadeUnderLine ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_20 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //市 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showCity AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityName AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "请选择" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . txtColor ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left " " AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cascadeUnderLine ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . txtColor ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCityData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceCode AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left " " AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cascadeUnderLine ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_20 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right //区 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showArea AST#member_expression#Right AST#expression#Right ) { //区域 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "请选择" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . txtColor ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left " " AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cascadeUnderLine ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . txtColor ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right = AST#expression#Left 2 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getAreaData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceCode AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityCode AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left " " AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cascadeUnderLine ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right == AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_10 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_35 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_5 AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left initialIndex : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cityTxtColor ( ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceCode AST#member_expression#Right AST#expression#Right ? AST#expression#Left "#1989fa" AST#expression#Right : AST#expression#Left "#323233" AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceCode AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaBase64ByNameSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "ok" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cityTxtColor ( ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityCode AST#member_expression#Right AST#expression#Right ? AST#expression#Left "#1989fa" AST#expression#Right : AST#expression#Left "#323233" AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityCode AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaBase64ByNameSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "ok" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . cityTxtColor ( ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaCode AST#member_expression#Right AST#expression#Right ? AST#expression#Left "#1989fa" AST#expression#Right : AST#expression#Left "#323233" AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right == AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaCode AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaBase64ByNameSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "ok" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . VP_15 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_20 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_5 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_5 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { //点击赋值选中的数据 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceCode AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityCode AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityName AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaCode AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showCity AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCityData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 200 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityCode AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaCode AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showArea AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getAreaData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceCode AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right = AST#expression#Left 2 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 200 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaCode AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //赋值 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . callCity AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . provinceName AST#member_expression#Right AST#expression#Right + AST#expression#Left "/" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . cityName AST#member_expression#Right AST#expression#Right + AST#expression#Left "/" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectData AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //赋值后初始化数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left City AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) // 排列方向 AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Auto AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBarWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_3 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBarColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . PRIMARY_COLOR AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_10 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left UiConst AST#expression#Right . NUMBER_20 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left PanelType AST#expression#Right . CUSTOM AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . dragBar ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left PanelHeight AST#expression#Right . WRAP_CONTENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . customHeight ( AST#expression#Left 600 AST#expression#Right ) // .backgroundColor("#22000000") // .backgroundMask(UiConst.DIALOG_CANCEL_COLOR) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct Cascade { @Link callCity: string @Link show: boolean @State private showCity: boolean = false @State private showArea: boolean = false private provinceList: Array<City> = new Array(); @State private selectData: cascadeCity = new cascadeCity(); @State private currentList: Array<City> = new Array(); @State private selectIndex: number = 0; @State titleFontSize: number | string = UiConst.FONT_16; aboutToAppear() { if (this.provinceList.length == 0) { this.init(); } } private init() { try { let jsonStr = getContext().resourceManager.getRawFileContentSync("area.json"); let textCoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); let vStr = textCoder.decodeWithStream(jsonStr, { stream: false }); this.provinceList = JSON.parse(vStr) as Array<City>; this.provinceList.forEach(province => { this.currentList.push(new City(province.name, province.code)); }) } catch (error) { let code = (error as BusinessError).code; let message = (error as BusinessError).message; ToastUtil.showToast(`获取区域数据出错, 错误编码: ${code}, 原因: ${message}.`); } } private getCityData(prevCode: string): Array<City> { return (this.provinceList.filter((pro: City) => pro.code == prevCode).pop() as City).children; } private getAreaData(prevCode: string, cityCode: string): Array<City> { return ((this.provinceList.filter((pro: City) => pro.code == prevCode) .pop() as City).children.filter((city: City) => city.code == cityCode).pop() as City).children; } private reset() { this.show = !this.show; this.showCity = false; this.showArea = false; this.selectData = new cascadeCity(); this.currentList = new Array(); this.selectIndex = 0; this.currentList = this.getProvinceData(); } private getProvinceData(): Array<City> { let provList: Array<City> = new Array(); this.provinceList.forEach(province => { provList.push(new City(province.name, province.code)); }) return provList; } build() { Panel(this.show) { Column() { Row() { Text('请选择地区').fontWeight('bold').fontSize(UiConst.FONT_16) Image(getContext().resourceManager.getMediaBase64ByNameSync("close")) .width(UiConst.VP_15) .height(UiConst.VP_15) .onClick(() => { this.reset() }) } .width('100%') .padding({ top: UiConst.NUMBER_15, left: UiConst.NUMBER_20, right: UiConst.NUMBER_25, bottom: UiConst.NUMBER_10 }) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.SpaceBetween) } Row() { Column() { if (this.selectIndex == 0 && !this.selectData.provinceName) { Text("请选择").txtColor(true, this.titleFontSize) Text(" ").cascadeUnderLine(true) } else { Text(this.selectData.provinceName).txtColor(false, this.titleFontSize).onClick(() => { this.selectIndex = 0; this.currentList = this.getProvinceData(); }) Text(" ").cascadeUnderLine(this.selectIndex == 0) } }.margin({ right: UiConst.NUMBER_20 }) if (this.showCity) { Column() { if (this.selectIndex === 1 && !this.selectData.cityName) { Text("请选择").txtColor(true, this.titleFontSize) Text(" ").cascadeUnderLine(true) } else { Text(this.selectData.cityName).txtColor(false, this.titleFontSize).onClick(() => { this.selectIndex = 1; this.currentList = this.getCityData(this.selectData.provinceCode); }) Text(" ").cascadeUnderLine(this.selectIndex == 1) } }.margin({ right: UiConst.NUMBER_20 }) } if (this.showArea) { 域 Column() { if (this.selectIndex === 2 && !this.selectData.areaName) { Text("请选择").txtColor(true, this.titleFontSize) Text(" ").cascadeUnderLine(true) } else { Text(this.selectData.areaName).txtColor(false, this.titleFontSize).onClick(() => { this.selectIndex = 2; this.currentList = this.getAreaData(this.selectData.provinceCode, this.selectData.cityCode); }) Text(" ").cascadeUnderLine(this.selectIndex == 2) } } } } .width("100%") .margin({ top: UiConst.NUMBER_10, left: UiConst.VP_35 }) .justifyContent(FlexAlign.Start) .alignItems(VerticalAlign.Center) Row() { List({ space: UiConst.NUMBER_5, initialIndex: 0 }) { ForEach(this.currentList, (item: City) => { ListItem() { Row() { if (this.selectIndex === 0) { Text(item.name) .cityTxtColor() .fontColor(item.code == this.selectData.provinceCode ? "#1989fa" : "#323233") if (item.code == this.selectData.provinceCode) { Image(getContext().resourceManager.getMediaBase64ByNameSync("ok")).width(UiConst.VP_15).height(UiConst.VP_15) } } if (this.selectIndex === 1) { Text(item.name) .cityTxtColor() .fontColor(item.code == this.selectData.cityCode ? "#1989fa" : "#323233") if (item.code == this.selectData.cityCode) { Image(getContext().resourceManager.getMediaBase64ByNameSync("ok")).width(UiConst.VP_15).height(UiConst.VP_15) } } if (this.selectIndex === 2) { Text(item.name) .cityTxtColor() .fontColor(item.code == this.selectData.areaCode ? "#1989fa" : "#323233") if (item.code == this.selectData.areaCode) { Image(getContext().resourceManager.getMediaBase64ByNameSync("ok")).width(UiConst.VP_15).height(UiConst.VP_15) } } } .width("100%") .justifyContent(FlexAlign.SpaceBetween) .alignItems(VerticalAlign.Center) .padding({ right: UiConst.NUMBER_20 }) } .margin({ top: UiConst.NUMBER_5, bottom: UiConst.NUMBER_5 }) .onClick(() => { if (this.selectIndex === 0) { this.selectData.provinceName = item.name; this.selectData.provinceCode = item.code; this.selectData.cityCode = ""; this.selectData.cityName = ""; this.selectData.areaCode = ""; this.selectData.areaName = ""; this.showCity = true; setTimeout(() => { this.currentList = this.getCityData(item.code); this.selectIndex = 1; }, 200) } if (this.selectIndex === 1) { this.selectData.cityName = item.name; this.selectData.cityCode = item.code; this.selectData.areaCode = ""; this.selectData.areaName = ""; this.showArea = true; setTimeout(() => { this.currentList = this.getAreaData(this.selectData.provinceCode, item.code); this.selectIndex = 2; }, 200) } if (this.selectIndex === 2) { this.selectData.areaName = item.name; this.selectData.areaCode = item.code; this.callCity = this.selectData.provinceName + "/" + this.selectData.cityName + "/" + this.selectData.areaName; 后初始化数据 this.reset() } }) }, (item: City) => item.code) } .listDirection(Axis.Vertical) .edgeEffect(EdgeEffect.None) .width('100%') .scrollBar(BarState.Auto) .scrollBarWidth(UiConst.NUMBER_3) .scrollBarColor(UiConst.PRIMARY_COLOR) .padding({ bottom: UiConst.NUMBER_10 }) } .height('100%') .width("100%") .alignItems(VerticalAlign.Top) .padding({ left: UiConst.NUMBER_20 }) } .type(PanelType.CUSTOM) .dragBar(false) .height(PanelHeight.WRAP_CONTENT) .customHeight(600) .position({ x: 0, y: 0 }) } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L62-L329
25dd1a2cd677438e48ac80bc60adb4ebacd9d7c9
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/StringCipherArkTS/entry/src/main/ets/common/utils/Logger.ets
arkts
constructor. @param Prefix identifies the log tag. @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
constructor(prefix: string = 'MyApp', domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'MyApp' AST#expression#Right AST#parameter#Right , AST#parameter#Left domain : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0xFF00 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . prefix AST#member_expression#Right = AST#expression#Left prefix AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . domain AST#member_expression#Right = AST#expression#Left domain AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor(prefix: string = 'MyApp', domain: number = 0xFF00) { this.prefix = prefix; this.domain = domain; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/common/utils/Logger.ets#L29-L32
585fc8eb7e59817e50bca8c90c9237660b6959a5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
getString
获取string类型的缓存值 @param key @returns
static async getString(key: string, defValue: string = "", preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<string> { let value = await PreferencesUtil.get(key, defValue, preferenceName); return value as string; }
AST#method_declaration#Left static async getString AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left PreferencesUtil AST#expression#Right . defaultPreferenceName AST#member_expression#Right AST#expression#Right AST#parameter#Right ) 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 > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left value = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PreferencesUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left defValue AST#expression#Right , AST#expression#Left preferenceName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left value AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async getString(key: string, defValue: string = "", preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<string> { let value = await PreferencesUtil.get(key, defValue, preferenceName); return value as string; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L139-L143
daadb00d6c593ba26228c7b0a0e540964c7fb792
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/customcomponents/CustomTabBar.ets
arkts
CustomTabBar
非选中状态的外边距初始值
@Component export struct CustomTabBar { @Link currentIndex: TabBarType; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; build() { Row() { ForEach(TabsInfo, (item: TabBarData) => { this.TabItem(item.id); }, (item: TabBarData) => item.id.toString()) } .padding({ bottom: px2vp(this.avoidAreaBottomToModule) }) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) .clip(false) .width($r('app.string.video_trimmer_custom_tab_bar_width')) } @Builder TabItem(index: number) { Column() { Image(this.currentIndex === index ? TabsInfo[index].activeIcon : TabsInfo[index].defaultIcon) .size(index === TabBarType.CHALLENGE ? { width: $r('app.float.video_trimmer_tab_big_img_width'), height: $r('app.float.video_trimmer_tab_big_img_height') } : { width: $r('app.float.video_trimmer_tab_img_size'), height: $r('app.float.video_trimmer_tab_img_size') }) .margin({ top: index === TabBarType.CHALLENGE ? $r('app.float.video_trimmer_tab_margin') : INITIAL_MARGIN }) Text(TabsInfo[index].title) .fontSize($r('app.float.video_trimmer_tab_font_size')) .margin({ top: $r('app.float.video_trimmer_tab_title_margin') }) .fontWeight(FONT_WEIGHT) .fontColor(this.currentIndex === index ? $r('app.color.video_trimmer_tab_title_font_color') : $r('app.color.video_trimmer_tab_title_font_color_change')) } .clip(false) .padding({ top: $r('app.integer.video_trimmer_tab_item_padding'), bottom: $r('app.integer.video_trimmer_tab_item_padding') }) .layoutWeight(1) .justifyContent(FlexAlign.Center) .onClick(() => { // 调用Toast显示提示:此样式仅为案例展示 promptAction.showToast({ message: $r("app.string.video_trimmer_toast_tips") }); }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'avoidAreaBottomToModule' AST#expression#Right ) AST#decorator#Right avoidAreaBottomToModule : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left TabsInfo AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabBarData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TabItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabBarData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avoidAreaBottomToModule AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_sub_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.video_trimmer_custom_tab_bar_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabItem 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#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left TabsInfo AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . activeIcon AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#subscript_expression#Left AST#expression#Left TabsInfo AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right . defaultIcon AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left TabBarType AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHALLENGE AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.video_trimmer_tab_big_img_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.video_trimmer_tab_big_img_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.video_trimmer_tab_img_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.video_trimmer_tab_img_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left TabBarType AST#expression#Right AST#binary_expression#Right AST#expression#Right . CHALLENGE AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.video_trimmer_tab_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left INITIAL_MARGIN AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left TabsInfo AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.video_trimmer_tab_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.video_trimmer_tab_title_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left FONT_WEIGHT AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.video_trimmer_tab_title_font_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.video_trimmer_tab_title_font_color_change' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.video_trimmer_tab_item_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.video_trimmer_tab_item_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.video_trimmer_toast_tips" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct CustomTabBar { @Link currentIndex: TabBarType; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; build() { Row() { ForEach(TabsInfo, (item: TabBarData) => { this.TabItem(item.id); }, (item: TabBarData) => item.id.toString()) } .padding({ bottom: px2vp(this.avoidAreaBottomToModule) }) .backgroundColor($r('sys.color.ohos_id_color_sub_background')) .clip(false) .width($r('app.string.video_trimmer_custom_tab_bar_width')) } @Builder TabItem(index: number) { Column() { Image(this.currentIndex === index ? TabsInfo[index].activeIcon : TabsInfo[index].defaultIcon) .size(index === TabBarType.CHALLENGE ? { width: $r('app.float.video_trimmer_tab_big_img_width'), height: $r('app.float.video_trimmer_tab_big_img_height') } : { width: $r('app.float.video_trimmer_tab_img_size'), height: $r('app.float.video_trimmer_tab_img_size') }) .margin({ top: index === TabBarType.CHALLENGE ? $r('app.float.video_trimmer_tab_margin') : INITIAL_MARGIN }) Text(TabsInfo[index].title) .fontSize($r('app.float.video_trimmer_tab_font_size')) .margin({ top: $r('app.float.video_trimmer_tab_title_margin') }) .fontWeight(FONT_WEIGHT) .fontColor(this.currentIndex === index ? $r('app.color.video_trimmer_tab_title_font_color') : $r('app.color.video_trimmer_tab_title_font_color_change')) } .clip(false) .padding({ top: $r('app.integer.video_trimmer_tab_item_padding'), bottom: $r('app.integer.video_trimmer_tab_item_padding') }) .layoutWeight(1) .justifyContent(FlexAlign.Center) .onClick(() => { promptAction.showToast({ message: $r("app.string.video_trimmer_toast_tips") }); }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/customcomponents/CustomTabBar.ets#L26-L78
e451e2067372cb3d9271a4471fbc0df6b52f82be
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/eraser/src/main/ets/model/RenderNodeModel.ets
arkts
MyRenderNode类,初始化画笔和绘制路径
export class MyRenderNode extends RenderNode { path: drawing.Path = new drawing.Path(); // 新建路径对象,用于绘制手指移动轨迹 pen: drawing.Pen = new drawing.Pen(); // 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制 blendMode: drawing.BlendMode = drawing.BlendMode.SRC_OVER; // 画笔的颜色混合模式 lineStrokeWidth: number = 0; // 画笔线宽 constructor() { super(); // 设置画笔颜色 const pen_color: common2D.Color = { alpha: 0xFF, red: 0xFA, green: 0x64, blue: 0x00 }; this.pen.setColor(pen_color); // 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑 this.pen.setAntiAlias(true); // 开启画笔的抖动绘制效果。抖动绘制可以使得绘制出的颜色更加真实。 this.pen.setDither(true); // 设置画笔绘制转角的样式为圆头 this.pen.setJoinStyle(drawing.JoinStyle.ROUND_JOIN); // 设置画笔线帽的样式,即画笔在绘制线段时在线段头尾端点的样式为半圆弧 this.pen.setCapStyle(drawing.CapStyle.ROUND_CAP); } // RenderNode进行绘制时会调用draw方法 draw(context: DrawContext): void { const canvas = context.canvas; // 设置画笔的颜色混合模式,根据不同的混合模式实现涂鸦和擦除效果 this.pen.setBlendMode(this.blendMode); // 设置画笔的线宽,单位px this.pen.setStrokeWidth(this.lineStrokeWidth); // 将Pen画笔设置到canvas中 canvas.attachPen(this.pen); // 绘制path canvas.drawPath(this.path); } }
AST#export_declaration#Left export AST#class_declaration#Left class MyRenderNode extends AST#type_annotation#Left AST#primary_type#Left RenderNode AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left path : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left drawing . Path AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left drawing AST#expression#Right AST#new_expression#Right AST#expression#Right . Path AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 新建路径对象,用于绘制手指移动轨迹 AST#property_declaration#Left pen : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left drawing . Pen AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left drawing AST#expression#Right AST#new_expression#Right AST#expression#Right . Pen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制 AST#property_declaration#Left blendMode : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left drawing . BlendMode AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left drawing AST#expression#Right . BlendMode AST#member_expression#Right AST#expression#Right . SRC_OVER AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 画笔的颜色混合模式 AST#property_declaration#Left lineStrokeWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 画笔线宽 AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置画笔颜色 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pen_color : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common2D . Color AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left alpha AST#property_name#Right : AST#expression#Left 0xFF AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left red AST#property_name#Right : AST#expression#Left 0xFA AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left green AST#property_name#Right : AST#expression#Left 0x64 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left blue AST#property_name#Right : AST#expression#Left 0x00 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pen_color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setAntiAlias AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 开启画笔的抖动绘制效果。抖动绘制可以使得绘制出的颜色更加真实。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setDither AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置画笔绘制转角的样式为圆头 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setJoinStyle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left drawing AST#expression#Right . JoinStyle AST#member_expression#Right AST#expression#Right . ROUND_JOIN AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置画笔线帽的样式,即画笔在绘制线段时在线段头尾端点的样式为半圆弧 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setCapStyle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left drawing AST#expression#Right . CapStyle AST#member_expression#Right AST#expression#Right . ROUND_CAP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right // RenderNode进行绘制时会调用draw方法 AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left DrawContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left canvas = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . canvas AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 设置画笔的颜色混合模式,根据不同的混合模式实现涂鸦和擦除效果 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setBlendMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . blendMode AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置画笔的线宽,单位px AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setStrokeWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lineStrokeWidth AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 将Pen画笔设置到canvas中 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left canvas AST#expression#Right . attachPen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 绘制path AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left canvas AST#expression#Right . drawPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . path AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class MyRenderNode extends RenderNode { path: drawing.Path = new drawing.Path(); pen: drawing.Pen = new drawing.Pen(); blendMode: drawing.BlendMode = drawing.BlendMode.SRC_OVER; lineStrokeWidth: number = 0; constructor() { super(); const pen_color: common2D.Color = { alpha: 0xFF, red: 0xFA, green: 0x64, blue: 0x00 }; this.pen.setColor(pen_color); this.pen.setAntiAlias(true); this.pen.setDither(true); this.pen.setJoinStyle(drawing.JoinStyle.ROUND_JOIN); this.pen.setCapStyle(drawing.CapStyle.ROUND_CAP); } draw(context: DrawContext): void { const canvas = context.canvas; this.pen.setBlendMode(this.blendMode); this.pen.setStrokeWidth(this.lineStrokeWidth); canvas.attachPen(this.pen); canvas.drawPath(this.path); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eraser/src/main/ets/model/RenderNodeModel.ets#L23-L61
1be48da295bc8a57d9d7946ec75bd5c340c9d8eb
gitee
CMoments/HarmonOS-arkTS-YunShangChuanDa.git
895985b9b6013c906bf88eaea6e32e03ddf2a9db
project code/entry/src/main/ets/components/NewsPage.ets
arkts
tabBar
当前选中的tab是第几个
@Builder tabBar(item: TabModel) { Column() { Row() { Text(item.name) .fontColor(this.tabModels[this.currentSelect].name == item.name ? '#ff4e4949' : Color.Grey) .fontSize(20) .fontWeight(700) .textAlign(TextAlign.Center) /*.decoration(this.tabModels[this.currentSelect].name == item.name ? { type: TextDecorationType.Underline, color: Color.Red } : { type: TextDecorationType.None, color: Color.Red })*/ .width('100%') } .justifyContent(FlexAlign.SpaceAround) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBar AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabModels AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelect AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right == AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ? AST#expression#Left '#ff4e4949' AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Grey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 700 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) /*.decoration(this.tabModels[this.currentSelect].name == item.name ? { type: TextDecorationType.Underline, color: Color.Red } : { type: TextDecorationType.None, color: Color.Red })*/ AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder tabBar(item: TabModel) { Column() { Row() { Text(item.name) .fontColor(this.tabModels[this.currentSelect].name == item.name ? '#ff4e4949' : Color.Grey) .fontSize(20) .fontWeight(700) .textAlign(TextAlign.Center) .width('100%') } .justifyContent(FlexAlign.SpaceAround) } }
https://github.com/CMoments/HarmonOS-arkTS-YunShangChuanDa.git/blob/895985b9b6013c906bf88eaea6e32e03ddf2a9db/project code/entry/src/main/ets/components/NewsPage.ets#L23-L46
d56e4907055fa170d57d05fb7ae08acf31275874
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/pages/Index.ets
arkts
notifyTaskUpdate
通知任务列表更新
notifyTaskUpdate() { this.taskUpdateSignal++; console.info('Index: notifyTaskUpdate called, taskUpdateSignal = ' + this.taskUpdateSignal); }
AST#method_declaration#Left notifyTaskUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskUpdateSignal AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Index: notifyTaskUpdate called, taskUpdateSignal = ' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . taskUpdateSignal AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
notifyTaskUpdate() { this.taskUpdateSignal++; console.info('Index: notifyTaskUpdate called, taskUpdateSignal = ' + this.taskUpdateSignal); }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/pages/Index.ets#L72-L75
bf0fb3d6bcf824726ca4070ff29d7c6ba7d93427
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/toast/ToastUtils.ets
arkts
showSuccess
显示成功提示 @param {string | ResourceStr} message - 提示内容 @returns {void} 无返回值
static showSuccess(message: string | ResourceStr): void { IBestToast.show({ type: "success", message: message }); }
AST#method_declaration#Left static showSuccess AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left IBestToast AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left "success" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left message AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static showSuccess(message: string | ResourceStr): void { IBestToast.show({ type: "success", message: message }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L22-L27
58bd26e6a845ea5bd34da36d2c5c9f3256baa3d2
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets
arkts
addSchedule
创建日程
static async addSchedule(postData:AddScheduleModel) { let httpRequest = http.createHttp(); let data = await httpRequest.request( `${DistScheduleService.distScheduleServer}/schedule`, { method: RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: postData, readTimeout: DistScheduleService.readTimeout, connectTimeout: DistScheduleService.connectTimeout } ); // @ts-ignore let result = JSON.parse(data.result) if (result.success) { return result.result } throw new Error(result.message) }
AST#method_declaration#Left static async addSchedule AST#parameter_list#Left ( AST#parameter#Left postData : AST#type_annotation#Left AST#primary_type#Left AddScheduleModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . distScheduleServer AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /schedule ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . POST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/json' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#Right : AST#expression#Left postData AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DistScheduleService AST#expression#Right . connectTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // @ts-ignore AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . success AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . result AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async addSchedule(postData:AddScheduleModel) { let httpRequest = http.createHttp(); let data = await httpRequest.request( `${DistScheduleService.distScheduleServer}/schedule`, { method: RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: postData, readTimeout: DistScheduleService.readTimeout, connectTimeout: DistScheduleService.connectTimeout } ); let result = JSON.parse(data.result) if (result.success) { return result.result } throw new Error(result.message) }
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L428-L451
6162925fe2afd74d8c36cdc8c2df9a451e96a475
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets
arkts
createEngine
调用speechRecognizer.createEngine接口创建引擎
private createEngine() { let extraParams: Record<string, Object> = { 'locate': 'CN', 'recognizerMode': 'short' } let createEngineParams: speechRecognizer.CreateEngineParams = { language: 'zh-CN', online: 1, extraParams: extraParams } speechRecognizer.createEngine(createEngineParams) .then((value: speechRecognizer.SpeechRecognitionEngine) => { asrEngine = value console.info(TAG, 'succeeded in creating engine.') }) .catch((error: BusinessError) => { console.error(TAG, `failed in creating engine, code: ${error.code}, message: ${error.message}`) }) }
AST#method_declaration#Left private createEngine AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left extraParams : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'locate' AST#property_name#Right : AST#expression#Left 'CN' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'recognizerMode' AST#property_name#Right : AST#expression#Left 'short' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left createEngineParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . CreateEngineParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left language AST#property_name#Right : AST#expression#Left 'zh-CN' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left online AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraParams AST#property_name#Right : AST#expression#Left extraParams AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left speechRecognizer AST#ERROR#Right . createEngine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left createEngineParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionEngine AST#qualified_type#Right 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#Left AST#expression#Left AST#assignment_expression#Left asrEngine = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'succeeded in creating engine.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError 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#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` failed in creating engine, code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private createEngine() { let extraParams: Record<string, Object> = { 'locate': 'CN', 'recognizerMode': 'short' } let createEngineParams: speechRecognizer.CreateEngineParams = { language: 'zh-CN', online: 1, extraParams: extraParams } speechRecognizer.createEngine(createEngineParams) .then((value: speechRecognizer.SpeechRecognitionEngine) => { asrEngine = value console.info(TAG, 'succeeded in creating engine.') }) .catch((error: BusinessError) => { console.error(TAG, `failed in creating engine, code: ${error.code}, message: ${error.message}`) }) }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets#L118-L138
7c675b850b611a3d710a75113a00b4390e7ab75b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/goods/GoodsParam.ets
arkts
@file 商品模块导航参数定义 @author Joker.X 商品分类参数
export interface GoodsCategoryParam { /** * 类型 ID(可选) */ typeId?: string; /** * 是否精选 */ featured?: boolean; /** * 是否推荐 */ recommend?: boolean; /** * 关键词(可选) */ keyword?: string; /** * 最小金额(可选) */ minPrice?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GoodsCategoryParam AST#object_type#Left { /** * 类型 ID(可选) */ AST#type_member#Left typeId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 是否精选 */ AST#type_member#Left featured ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 是否推荐 */ AST#type_member#Left recommend ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 关键词(可选) */ AST#type_member#Left keyword ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 最小金额(可选) */ AST#type_member#Left minPrice ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface GoodsCategoryParam { typeId?: string; featured?: boolean; recommend?: boolean; keyword?: string; minPrice?: string; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/goods/GoodsParam.ets#L9-L30
353b8688f3c3845184b2d14fb88a77918a340557
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/DictSelectModal.ets
arkts
CustomError
自定义错误状态 @returns {void} 无返回值
@Builder private CustomError(): void { Column() { EmptyNetwork({ onAction: (): void => this.onRetry() }); } .height(300) .width(P100); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CustomError AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left EmptyNetwork ( AST#component_parameters#Left { AST#component_parameter#Left onAction : AST#expression#Left AST#arrow_function#Left 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRetry AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 300 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private CustomError(): void { Column() { EmptyNetwork({ onAction: (): void => this.onRetry() }); } .height(300) .width(P100); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L221-L230
6b20a1b92e6f368b0c1f782db6193f672066d807
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
mkdtemp
创建临时目录,使用Promise异步回调。 @param prefix string 用随机产生的字符串替换以“XXXXXX”结尾目录路径。 @returns
static mkdtemp(prefix: string): Promise<string> { return fs.mkdtemp(prefix); }
AST#method_declaration#Left static mkdtemp AST#parameter_list#Left ( AST#parameter#Left prefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . mkdtemp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left prefix AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static mkdtemp(prefix: string): Promise<string> { return fs.mkdtemp(prefix); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L837-L839
8fa915a7697e9461adfa84595c306ecba764abfc
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
delay
工具方法:延迟
private delay(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
AST#method_declaration#Left private delay AST#parameter_list#Left ( AST#parameter#Left ms : 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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left resolve => AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left resolve AST#expression#Right , AST#expression#Left ms AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private delay(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L677-L679
bdc464363e2cf5bf2abc6fd86ee8f6d19c8ea6d2
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets
arkts
selectRefundReason
选择退款原因 @param {DictItem | null} reason - 退款原因 @returns {void} 无返回值
selectRefundReason(reason: DictItem | null): void { this.selectedRefundReason = reason; }
AST#method_declaration#Left selectRefundReason AST#parameter_list#Left ( AST#parameter#Left reason : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DictItem AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedRefundReason AST#member_expression#Right = AST#expression#Left reason AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
selectRefundReason(reason: DictItem | null): void { this.selectedRefundReason = reason; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L106-L108
06ae8804243824f45ebb525a4d199dbf56ae6e2f
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/formatter/DefaultAxisValueFormatter.ets
arkts
getDecimalDigits
Returns the number of decimal digits this formatter uses or -1, if unspecified. @return
public getDecimalDigits(): number { return this.digits; }
AST#method_declaration#Left public getDecimalDigits AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . digits AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getDecimalDigits(): number { return this.digits; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/DefaultAxisValueFormatter.ets#L58-L60
69c5a7a8b012f7daa2014d973c107f815a45f76a
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
获取用户关注列表 @param userId 用户ID @param page 页码 @param size 每页大小 @returns 关注列表
export function getUserFollowings(userId: number, page: number = 0, size: number = 20): Promise<PageResponse<UserInfo>> { try { console.info(`获取用户关注列表, userId: ${userId}, page: ${page}, size: ${size}`); const params = {} as QueryParams; params.page = page; params.size = size; return request<PageResponse<UserInfo>>(RequestMethod.GET, `/users/${userId}/followings`, params); } catch (error) { console.error(`获取用户关注列表失败: ${error instanceof Error ? error.message : String(error)}`); // 返回空数据结构 const emptyResponse: PageResponse<UserInfo> = { content: [], totalElements: 0, totalPages: 0, size: size, number: page, first: true, last: true }; return Promise.resolve(emptyResponse); } }
AST#export_declaration#Left export AST#function_declaration#Left function getUserFollowings AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right AST#parameter#Right ) 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 AST#generic_type#Left PageResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取用户关注列表, userId: AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right , page: AST#template_substitution#Left $ { AST#expression#Left page AST#expression#Right } AST#template_substitution#Right , size: AST#template_substitution#Left $ { AST#expression#Left size AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left QueryParams AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . page AST#member_expression#Right = AST#expression#Left page AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . size AST#member_expression#Right = AST#expression#Left size AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left PageResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /users/ AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right /followings ` AST#template_literal#Right AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取用户关注列表失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 返回空数据结构 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left emptyResponse : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left PageResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalElements AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalPages AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left size AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left number AST#property_name#Right : AST#expression#Left page AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left first AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left last AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Promise AST#expression#Right . resolve AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left emptyResponse AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getUserFollowings(userId: number, page: number = 0, size: number = 20): Promise<PageResponse<UserInfo>> { try { console.info(`获取用户关注列表, userId: ${userId}, page: ${page}, size: ${size}`); const params = {} as QueryParams; params.page = page; params.size = size; return request<PageResponse<UserInfo>>(RequestMethod.GET, `/users/${userId}/followings`, params); } catch (error) { console.error(`获取用户关注列表失败: ${error instanceof Error ? error.message : String(error)}`); const emptyResponse: PageResponse<UserInfo> = { content: [], totalElements: 0, totalPages: 0, size: size, number: page, first: true, last: true }; return Promise.resolve(emptyResponse); } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1441-L1463
08c31251933b67a9f4f292f1036553511a8a7b83
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
arkts
add1stItem
增加数据
public add1stItem(): void { this.dataArray.splice(0, 0, this.dataArray.length); this.notifyDataAdd(0); }
AST#method_declaration#Left public add1stItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public add1stItem(): void { this.dataArray.splice(0, 0, this.dataArray.length); this.notifyDataAdd(0); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L88-L91
947f801135e882759c319fed2a29ba163ee91911
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/model/SocketFactory.ets
arkts
createSocket
根据协议类型创建对应的Socket @param socketType
public static createSocket(socketType: SocketType): Socket { switch (socketType) { case SocketType.UDP: return new UdpSocket(); case SocketType.TCP: return new TcpSocket(); case SocketType.TLS: return new TlsSocket(); } }
AST#method_declaration#Left public static createSocket AST#parameter_list#Left ( AST#parameter#Left socketType : AST#type_annotation#Left AST#primary_type#Left SocketType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Socket AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switch ( AST#expression#Left socketType AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SocketType AST#expression#Right . UDP AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left UdpSocket AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SocketType AST#expression#Right . TCP AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TcpSocket AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SocketType AST#expression#Right . TLS AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TlsSocket AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
public static createSocket(socketType: SocketType): Socket { switch (socketType) { case SocketType.UDP: return new UdpSocket(); case SocketType.TCP: return new TcpSocket(); case SocketType.TLS: return new TlsSocket(); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/model/SocketFactory.ets#L30-L39
2e3e060c6bdf8987f0917a5719a7c1af14a29f30
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
featureVersion
Feature版本号,标识规划的新特性版本。
static featureVersion(): string { return deviceInfo.featureVersion + '' }
AST#method_declaration#Left static featureVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left deviceInfo AST#expression#Right . featureVersion AST#member_expression#Right AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static featureVersion(): string { return deviceInfo.featureVersion + '' }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L154-L156
d29fb45a1beb6471c848cfaadb83b70231469506
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/utils/PreferenceModel.ets
arkts
getMovieSeachKeyWord
获取date日期对应的浏览历史
async getMovieSeachKeyWord():Promise<Array<string>> { let movieSearchKeyWord = <string> await this.getPreference('movieSearchKeyWord'); if(movieSearchKeyWord){ return JSON.parse(movieSearchKeyWord) }else { return [] } }
AST#method_declaration#Left async getMovieSeachKeyWord 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 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_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left movieSearchKeyWord = AST#ERROR#Left AST#expression#Left AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreference AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'movieSearchKeyWord' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left movieSearchKeyWord AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left movieSearchKeyWord AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getMovieSeachKeyWord():Promise<Array<string>> { let movieSearchKeyWord = <string> await this.getPreference('movieSearchKeyWord'); if(movieSearchKeyWord){ return JSON.parse(movieSearchKeyWord) }else { return [] } }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L94-L101
984e9879ed0e2a9002d9cecc4054dca31fb08596
github
yanweiguo198-commits/Harmony-Calendar-App.git
9ebdfbe588dfc230231af619a6eeb89b3c7fc39f
entry/src/main/ets/pages/Index.ets
arkts
openDialog
打开弹窗的方法
openDialog(event?: CalendarEvent) { this.editingEvent = event; // 如果 event 有值就是编辑,没值就是新建 this.dialogController = new CustomDialogController({ builder: AddEventDialog({ selectedDate: this.currentDate, editEvent: this.editingEvent, // 把要编辑的事件传进去 onSave: (savedEvent: CalendarEvent) => { this.handleSaveEvent(savedEvent); } }), alignment: DialogAlignment.Bottom, customStyle: true, autoCancel: true }); this.dialogController.open(); }
AST#method_declaration#Left openDialog AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left CalendarEvent 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#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . editingEvent AST#member_expression#Right = AST#expression#Left event AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 如果 event 有值就是编辑,没值就是新建 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogController AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CustomDialogController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left builder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AddEventDialog AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left selectedDate AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentDate AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left editEvent AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . editingEvent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 把要编辑的事件传进去 AST#property_assignment#Left AST#property_name#Left onSave AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left savedEvent : AST#type_annotation#Left AST#primary_type#Left CalendarEvent 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#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleSaveEvent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left savedEvent AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customStyle AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left autoCancel AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogController AST#member_expression#Right AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
openDialog(event?: CalendarEvent) { this.editingEvent = event; this.dialogController = new CustomDialogController({ builder: AddEventDialog({ selectedDate: this.currentDate, editEvent: this.editingEvent, onSave: (savedEvent: CalendarEvent) => { this.handleSaveEvent(savedEvent); } }), alignment: DialogAlignment.Bottom, customStyle: true, autoCancel: true }); this.dialogController.open(); }
https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/pages/Index.ets#L24-L41
bda9d34611a2db1d91d0f66266716fb98ccd0ded
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
dateOn
/ 获取指定dayOf的日期
dateOn(dayOf: DayOf): Date | null { if (this.startDate !== null) { return this.addDays(this.startDate, dayOf.num); } return null; }
AST#method_declaration#Left dateOn AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startDate AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startDate AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left dayOf AST#expression#Right . num AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
dateOn(dayOf: DayOf): Date | null { if (this.startDate !== null) { return this.addDays(this.startDate, dayOf.num); } return null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L119-L124
e63324b729d9eeaa190dc2cfc961aa3a636e0593
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/MessageAttachment.ets
arkts
Represents an attachment in a message.
export class MessageAttachment { // 应用约束2: 显式声明类属性(ArkTS要求类属性必须在类体中显式声明) // 应用约束7: 使用private/readonly修饰符替代#私有字段 readonly client: Client; message: Message; id: string; // 假设Snowflake类型为string filename: string; filesize: number; url: string; proxyURL: string; height: number | null; width: number | null; // 应用约束18: 禁止在构造函数参数中声明类字段 constructor(message: Message, data: MessageAttachmentData) { // 应用约束2: 通过构造函数初始化字段 this.client = message.client; this.message = message; // 应用约束39: 将setup方法逻辑合并到构造函数 this.id = data.id; this.filename = data.filename; this.filesize = data.size; this.url = data.url; this.proxyURL = data.proxy_url; this.height = data.height ?? null; this.width = data.width ?? null; } }
AST#export_declaration#Left export AST#class_declaration#Left class MessageAttachment AST#class_body#Left { // 应用约束2: 显式声明类属性(ArkTS要求类属性必须在类体中显式声明) // 应用约束7: 使用private/readonly修饰符替代#私有字段 AST#property_declaration#Left readonly client : AST#type_annotation#Left AST#primary_type#Left Client AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left message : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right 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 // 假设Snowflake类型为string AST#property_declaration#Left filename : 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 filesize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left url : 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 proxyURL : 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 height : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left width : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 应用约束18: 禁止在构造函数参数中声明类字段 AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left MessageAttachmentData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 应用约束2: 通过构造函数初始化字段 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . client AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right = AST#expression#Left message AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 应用约束39: 将setup方法逻辑合并到构造函数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filename AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . filename AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filesize AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . size AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . url AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . url AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . proxyURL AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . proxy_url AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . height AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . width AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class MessageAttachment { readonly client: Client; message: Message; id: string; filename: string; filesize: number; url: string; proxyURL: string; height: number | null; width: number | null; constructor(message: Message, data: MessageAttachmentData) { this.client = message.client; this.message = message; this.id = data.id; this.filename = data.filename; this.filesize = data.size; this.url = data.url; this.proxyURL = data.proxy_url; this.height = data.height ?? null; this.width = data.width ?? null; } }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/MessageAttachment.ets#L4-L32
160a89fa1e134efb8227cf255e5ca4fe1041dffc
github
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/client/CustomOptions.ets
arkts
自定义连接选项
export class CustomOptions { /** * 是否使用自动重连功能 */ private _reConnect: boolean = true; public set reConnect(value: boolean) { this._reConnect = value; } public get reConnect(): boolean { return this._reConnect; } /** * 退避系数, 默认为1000,单位毫秒 */ private _backoff: number = IoTUtil.DEFAULT_BACKOFF; public set backoff(value: number) { this._backoff = value; } public get backoff(): number { return this._backoff; } /** * 最小重连时间,默认为1000,单位毫秒 */ private _minBackoff: number = IoTUtil.MIN_BACKOFF; public set minBackoff(value: number) { this._minBackoff = value; } public get minBackoff(): number { return this._minBackoff; } /** * 最大重连时间,默认为30 * 1000,单位毫秒 */ private _maxBackoff: number = IoTUtil.MAX_BACKOFF; public set maxBackoff(value: number) { this._maxBackoff = value; } public get maxBackoff(): number { return this._maxBackoff; } private _customBackoffHandler: CustomBackoffHandler | null = null; public set customBackoffHandler(value: CustomBackoffHandler | null) { this._customBackoffHandler = value; } public get customBackoffHandler(): CustomBackoffHandler | null { return this._customBackoffHandler; } /** * 正在传输但还未收到确认的消息数量,默认为65535 */ private _maxInflight: number = 65534; public set maxInflight(value: number) { this._maxInflight = value; } public get maxInflight(): number { return this._maxInflight; } /** * 离线消息缓存队列大小,默认5000 */ private _offlineBufferSize: number = 5000; public set offlineBufferSize(value: number) { this._offlineBufferSize = value; } public get offlineBufferSize(): number { return this._offlineBufferSize; } }
AST#export_declaration#Left export AST#class_declaration#Left class CustomOptions AST#class_body#Left { /** * 是否使用自动重连功能 */ AST#property_declaration#Left private _reConnect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public set AST#ERROR#Left reConnect AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _reConnect AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public get AST#ERROR#Left reConnect AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _reConnect AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 退避系数, 默认为1000,单位毫秒 */ AST#property_declaration#Left private _backoff : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left IoTUtil AST#expression#Right . DEFAULT_BACKOFF AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public set AST#ERROR#Left back of f AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : 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#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _backoff AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public get AST#ERROR#Left back of f AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _backoff AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 最小重连时间,默认为1000,单位毫秒 */ AST#property_declaration#Left private _minBackoff : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left IoTUtil AST#expression#Right . MIN_BACKOFF AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public set AST#ERROR#Left m in Back of f AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : 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#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _minBackoff AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public get AST#ERROR#Left m in Back of f AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _minBackoff AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 最大重连时间,默认为30 * 1000,单位毫秒 */ AST#property_declaration#Left private _maxBackoff : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left IoTUtil AST#expression#Right . MAX_BACKOFF AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public set AST#ERROR#Left maxBack of f AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : 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#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _maxBackoff AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public get AST#ERROR#Left maxBack of f AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _maxBackoff AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#property_declaration#Left private _customBackoffHandler : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CustomBackoffHandler AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public set AST#ERROR#Left customBack of fHandler AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CustomBackoffHandler AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _customBackoffHandler AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public get AST#ERROR#Left customBack of fHandler AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CustomBackoffHandler AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _customBackoffHandler AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 正在传输但还未收到确认的消息数量,默认为65535 */ AST#property_declaration#Left private _maxInflight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 65534 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public set AST#ERROR#Left maxInflight AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : 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#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _maxInflight AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public get AST#ERROR#Left maxInflight AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _maxInflight AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 离线消息缓存队列大小,默认5000 */ AST#property_declaration#Left private _offlineBufferSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5000 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public set AST#ERROR#Left of fl in eBufferSize AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : 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#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _offlineBufferSize AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public get AST#ERROR#Left of fl in eBufferSize AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _offlineBufferSize AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CustomOptions { private _reConnect: boolean = true; public set reConnect(value: boolean) { this._reConnect = value; } public get reConnect(): boolean { return this._reConnect; } private _backoff: number = IoTUtil.DEFAULT_BACKOFF; public set backoff(value: number) { this._backoff = value; } public get backoff(): number { return this._backoff; } private _minBackoff: number = IoTUtil.MIN_BACKOFF; public set minBackoff(value: number) { this._minBackoff = value; } public get minBackoff(): number { return this._minBackoff; } private _maxBackoff: number = IoTUtil.MAX_BACKOFF; public set maxBackoff(value: number) { this._maxBackoff = value; } public get maxBackoff(): number { return this._maxBackoff; } private _customBackoffHandler: CustomBackoffHandler | null = null; public set customBackoffHandler(value: CustomBackoffHandler | null) { this._customBackoffHandler = value; } public get customBackoffHandler(): CustomBackoffHandler | null { return this._customBackoffHandler; } private _maxInflight: number = 65534; public set maxInflight(value: number) { this._maxInflight = value; } public get maxInflight(): number { return this._maxInflight; } private _offlineBufferSize: number = 5000; public set offlineBufferSize(value: number) { this._offlineBufferSize = value; } public get offlineBufferSize(): number { return this._offlineBufferSize; } }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/CustomOptions.ets#L21-L109
a4c5a86fbeb9214e7b17c7cd2a769cc3f5bc74eb
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Chip.d.ets
arkts
Defines localized label margin. @interface LocalizedLabelMarginOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface LocalizedLabelMarginOptions { /** * start localized label margin length. * * @type { ?LengthMetrics } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ start?: LengthMetrics; /** * end localized label margin length. * * @type { ?LengthMetrics } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ end?: LengthMetrics; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LocalizedLabelMarginOptions AST#object_type#Left { /** * start localized label margin length. * * @type { ?LengthMetrics } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left start ? : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * end localized label margin length. * * @type { ?LengthMetrics } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left end ? : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface LocalizedLabelMarginOptions { start?: LengthMetrics; end?: LengthMetrics; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L504-L527
0e9b15f3d24d7b3e392cdd7ed5fc553411eaef89
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/PureTabsExt/entry/src/main/ets/view/OutTabComponent.ets
arkts
tabBuilder
[StartExclude tabs_clip]
@Builder tabBuilder(index: number, name: string | Resource, icon: Resource) { Column() { SymbolGlyph(icon).fontColor([this.selectedIndex === index ? $r('app.color.out_tab_bar_font_active_color') : $r('app.color.out_tab_bar_font_inactive_color')]) .fontSize(25) Text(name) .margin({ top: 4 }) .fontSize(10) .fontColor(this.selectedIndex === index ? $r('app.color.out_tab_bar_font_active_color') : $r('app.color.out_tab_bar_font_inactive_color')) } .justifyContent(FlexAlign.Center) .height(60) .width('100%') .margin({bottom:60}) .offset({ y: this.selectedIndex === index ? -18 : 0 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilder 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#Left name : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : 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#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SymbolGlyph ( AST#expression#Left icon AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.out_tab_bar_font_active_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.out_tab_bar_font_inactive_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 25 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left name AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.out_tab_bar_font_active_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.out_tab_bar_font_inactive_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 60 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . offset ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 18 AST#expression#Right AST#unary_expression#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder tabBuilder(index: number, name: string | Resource, icon: Resource) { Column() { SymbolGlyph(icon).fontColor([this.selectedIndex === index ? $r('app.color.out_tab_bar_font_active_color') : $r('app.color.out_tab_bar_font_inactive_color')]) .fontSize(25) Text(name) .margin({ top: 4 }) .fontSize(10) .fontColor(this.selectedIndex === index ? $r('app.color.out_tab_bar_font_active_color') : $r('app.color.out_tab_bar_font_inactive_color')) } .justifyContent(FlexAlign.Center) .height(60) .width('100%') .margin({bottom:60}) .offset({ y: this.selectedIndex === index ? -18 : 0 }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/PureTabsExt/entry/src/main/ets/view/OutTabComponent.ets#L35-L56
e2e3f0086e3198e37b9b70577dbf609119715641
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/router/AppRouter.ets
arkts
getCurrentParams
获取当前页面参数
getCurrentParams(): RouteParams { try { const state = router.getState(); return state.params as RouteParams || {}; } catch (error) { hilog.error(0x0001, 'BirthdayReminder', `Failed to get current params: ${error}`); return {}; } }
AST#method_declaration#Left getCurrentParams AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RouteParams AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left state = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . getState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left state AST#expression#Right . params AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left RouteParams AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right || AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#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 . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0001 AST#expression#Right , AST#expression#Left 'BirthdayReminder' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to get current params: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getCurrentParams(): RouteParams { try { const state = router.getState(); return state.params as RouteParams || {}; } catch (error) { hilog.error(0x0001, 'BirthdayReminder', `Failed to get current params: ${error}`); return {}; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L199-L208
825d97d0c8d06221fb9434bad2e634c050752e32
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SM4.ets
arkts
encodeECB
加密-ECB模式 @param str 待加密的字符串 @param sm4Key SM4密钥 @returns
static async encodeECB(str: string, sm4Key: string): Promise<string> { return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128); }
AST#method_declaration#Left static async encodeECB AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . encodeECB AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left sm4Key AST#expression#Right , AST#expression#Left 'SM4_128' AST#expression#Right , AST#expression#Left 'SM4_128|ECB|PKCS7' AST#expression#Right , AST#expression#Left 128 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async encodeECB(str: string, sm4Key: string): Promise<string> { return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4.ets#L41-L43
8f4563f5d2152566ccfad31e210eec7a8b89aba2
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/container/queue_field_sensitive_001_T.ets
arkts
Introduction Queue域敏感
export function queue_field_sensitive_001_T(taint_src : string) { let s = new Queue<string>(); s.add(taint_src); s.add("clean"); taint.Sink(s.getFirst()); }
AST#export_declaration#Left export AST#function_declaration#Left function queue_field_sensitive_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left s = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Queue AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "clean" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . getFirst AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function queue_field_sensitive_001_T(taint_src : string) { let s = new Queue<string>(); s.add(taint_src); s.add("clean"); taint.Sink(s.getFirst()); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/queue_field_sensitive_001_T.ets#L7-L12
ae97ed4f7e293b47bee54f6de6c07a019ac144f1
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
updateSettings
更新通知设置
public updateSettings(newSettings: Partial<NotificationSettings>): void { if (newSettings.enabled !== undefined) this.settings.enabled = newSettings.enabled; if (newSettings.soundEnabled !== undefined) this.settings.soundEnabled = newSettings.soundEnabled; if (newSettings.vibrationEnabled !== undefined) this.settings.vibrationEnabled = newSettings.vibrationEnabled; if (newSettings.notificationEnabled !== undefined) this.settings.notificationEnabled = newSettings.notificationEnabled; if (newSettings.dialogEnabled !== undefined) this.settings.dialogEnabled = newSettings.dialogEnabled; if (newSettings.badgeEnabled !== undefined) this.settings.badgeEnabled = newSettings.badgeEnabled; if (newSettings.reminderTime !== undefined) this.settings.reminderTime = newSettings.reminderTime; if (newSettings.advanceRemindDays !== undefined) this.settings.advanceRemindDays = newSettings.advanceRemindDays; if (newSettings.selectedRingtone !== undefined) this.settings.selectedRingtone = newSettings.selectedRingtone; if (newSettings.repeatDaily !== undefined) this.settings.repeatDaily = newSettings.repeatDaily; if (newSettings.weekendEnabled !== undefined) this.settings.weekendEnabled = newSettings.weekendEnabled; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Settings updated: ${JSON.stringify(newSettings)}`); }
AST#method_declaration#Left public updateSettings AST#parameter_list#Left ( AST#parameter#Left newSettings : 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 NotificationSettings AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . enabled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . soundEnabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . soundEnabled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . soundEnabled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . vibrationEnabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . vibrationEnabled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . vibrationEnabled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . notificationEnabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . notificationEnabled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . notificationEnabled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . dialogEnabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . dialogEnabled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . dialogEnabled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . badgeEnabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . badgeEnabled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . badgeEnabled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . reminderTime AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . reminderTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . reminderTime AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . advanceRemindDays AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . advanceRemindDays AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . advanceRemindDays AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . selectedRingtone AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . selectedRingtone AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . selectedRingtone AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . repeatDaily AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . repeatDaily AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . repeatDaily AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . weekendEnabled AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . weekendEnabled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newSettings AST#expression#Right . weekendEnabled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#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_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [NotificationService] Settings updated: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newSettings AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public updateSettings(newSettings: Partial<NotificationSettings>): void { if (newSettings.enabled !== undefined) this.settings.enabled = newSettings.enabled; if (newSettings.soundEnabled !== undefined) this.settings.soundEnabled = newSettings.soundEnabled; if (newSettings.vibrationEnabled !== undefined) this.settings.vibrationEnabled = newSettings.vibrationEnabled; if (newSettings.notificationEnabled !== undefined) this.settings.notificationEnabled = newSettings.notificationEnabled; if (newSettings.dialogEnabled !== undefined) this.settings.dialogEnabled = newSettings.dialogEnabled; if (newSettings.badgeEnabled !== undefined) this.settings.badgeEnabled = newSettings.badgeEnabled; if (newSettings.reminderTime !== undefined) this.settings.reminderTime = newSettings.reminderTime; if (newSettings.advanceRemindDays !== undefined) this.settings.advanceRemindDays = newSettings.advanceRemindDays; if (newSettings.selectedRingtone !== undefined) this.settings.selectedRingtone = newSettings.selectedRingtone; if (newSettings.repeatDaily !== undefined) this.settings.repeatDaily = newSettings.repeatDaily; if (newSettings.weekendEnabled !== undefined) this.settings.weekendEnabled = newSettings.weekendEnabled; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Settings updated: ${JSON.stringify(newSettings)}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L95-L109
13f4f6558eccbe10765a455e7c7413858f8f6532
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
getInstance
获取DatabaseService单例实例
static getInstance(): DatabaseService { if (!DatabaseService.instance) { DatabaseService.instance = new DatabaseService(); } return DatabaseService.instance; }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DatabaseService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left DatabaseService AST#expression#Right AST#unary_expression#Right AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left DatabaseService AST#expression#Right . instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DatabaseService AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DatabaseService AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static getInstance(): DatabaseService { if (!DatabaseService.instance) { DatabaseService.instance = new DatabaseService(); } return DatabaseService.instance; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L39-L44
0197233d281b847869c966b76dc30cfd81735fa2
github
dou101101/ZenFocus-HarmonyOS.git
9364599b8b20bc6377fc55ac68b991b61ceb8496
MyApplication/entry/src/main/ets/pages/Index.ets
arkts
getTreeIcon
=== 视觉辅助函数 ===
getTreeIcon(progress: number): string { if (progress < 0.2) return '🌱'; // 幼苗 if (progress < 0.5) return '🌿'; // 树苗 if (progress < 0.8) return '🌳'; // 大树 return '🌸'; // 开花/结果 (完成态) }
AST#method_declaration#Left getTreeIcon AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left progress AST#expression#Right < AST#expression#Left 0.2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left '🌱' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 幼苗 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left progress AST#expression#Right < AST#expression#Left 0.5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left '🌿' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 树苗 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left progress AST#expression#Right < AST#expression#Left 0.8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left '🌳' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 大树 AST#statement#Left AST#return_statement#Left return AST#expression#Left '🌸' AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 开花/结果 (完成态) } AST#block_statement#Right AST#method_declaration#Right
getTreeIcon(progress: number): string { if (progress < 0.2) return '🌱'; if (progress < 0.5) return '🌿'; if (progress < 0.8) return '🌳'; return '🌸'; }
https://github.com/dou101101/ZenFocus-HarmonyOS.git/blob/9364599b8b20bc6377fc55ac68b991b61ceb8496/MyApplication/entry/src/main/ets/pages/Index.ets#L351-L356
23f6ad06905d6a73d2ab834ee1863086a5f52114
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
LunarCalendar_Fixed.ets
arkts
getSolarMonthDays
获取公历年某月的天数
private static getSolarMonthDays(year: number, month: number): number { if (month === 2 && LunarCalendarFixed.isLeapYear(year)) { return 29; } return SOLAR_MONTH[month - 1]; }
AST#method_declaration#Left private static getSolarMonthDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left LunarCalendarFixed AST#expression#Right AST#binary_expression#Right AST#expression#Right . isLeapYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 29 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left SOLAR_MONTH AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private static getSolarMonthDays(year: number, month: number): number { if (month === 2 && LunarCalendarFixed.isLeapYear(year)) { return 29; } return SOLAR_MONTH[month - 1]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L242-L247
4670cfbd78f22db97725f6e7949a0bfc33a1e899
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/contacts/ContactImportPage.ets
arkts
buildImportResult
构建导入结果页面
@Builder buildImportResult() { if (this.importResult) { Column({ space: 24 }) { // 结果概览 Column({ space: 16 }) { Text('导入结果') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Row({ space: 20 }) { this.buildResultCard('总数', this.importResult.total, '#007AFF') this.buildResultCard('成功', this.importResult.successful, '#28a745') this.buildResultCard('失败', this.importResult.failed, '#dc3545') } .width('100%') .justifyContent(FlexAlign.SpaceEvenly) } // 错误详情 if (this.importResult.errors.length > 0) { Column({ space: 12 }) { Text(`错误详情 (${this.importResult.errors.length}个)`) .fontSize(18) .fontColor('#dc3545') .alignSelf(ItemAlign.Start) Scroll() { Column({ space: 8 }) { ForEach(this.importResult.errors, (error: ImportError) => { Text(`行${error.row}: ${error.error}`) .fontSize(14) .fontColor('#dc3545') .alignSelf(ItemAlign.Start) }) } .width('100%') .alignItems(HorizontalAlign.Start) } .height('200vp') .width('100%') } .width('100%') .padding(16) .backgroundColor('#fff5f5') .borderRadius(12) } // 操作按钮 Row({ space: 12 }) { Button('重新导入') .type(ButtonType.Normal) .fontSize(16) .fontColor('#4ECDC4') .backgroundColor('#f0fffe') .border({ width: 1, color: '#4ECDC4' }) .borderRadius(8) .layoutWeight(1) .onClick(() => { this.resetImportResult(); }) Button('完成') .fontSize(16) .fontColor('#ffffff') .backgroundColor('#4ECDC4') .borderRadius(8) .layoutWeight(1) .onClick(() => { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Import completed, navigating to ContactsPage...'); router.replaceUrl({ url: 'pages/ContactsPage' }); }) } .width('100%') } .width('100%') .padding(16) .justifyContent(FlexAlign.Center) .height('100%') } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildImportResult AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . importResult AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 24 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 结果概览 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '导入结果' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 20 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildResultCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '总数' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . importResult AST#member_expression#Right AST#expression#Right . total AST#member_expression#Right AST#expression#Right , AST#expression#Left '#007AFF' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildResultCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '成功' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . importResult AST#member_expression#Right AST#expression#Right . successful AST#member_expression#Right AST#expression#Right , AST#expression#Left '#28a745' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildResultCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '失败' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . importResult AST#member_expression#Right AST#expression#Right . failed AST#member_expression#Right AST#expression#Right , AST#expression#Left '#dc3545' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceEvenly AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 错误详情 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . importResult AST#member_expression#Right AST#expression#Right . errors AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 错误详情 ( AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . importResult AST#member_expression#Right AST#expression#Right . errors AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 个) ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#dc3545' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . importResult AST#member_expression#Right AST#expression#Right . errors AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left ImportError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 行 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . row AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . error AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#dc3545' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '200vp' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#fff5f5' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 操作按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '重新导入' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#4ECDC4' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f0fffe' AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#4ECDC4' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetImportResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '完成' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#4ECDC4' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#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_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left 'Import completed, navigating to ContactsPage...' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . replaceUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left 'pages/ContactsPage' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildImportResult() { if (this.importResult) { Column({ space: 24 }) { Column({ space: 16 }) { Text('导入结果') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Row({ space: 20 }) { this.buildResultCard('总数', this.importResult.total, '#007AFF') this.buildResultCard('成功', this.importResult.successful, '#28a745') this.buildResultCard('失败', this.importResult.failed, '#dc3545') } .width('100%') .justifyContent(FlexAlign.SpaceEvenly) } if (this.importResult.errors.length > 0) { Column({ space: 12 }) { Text(`错误详情 (${this.importResult.errors.length}个)`) .fontSize(18) .fontColor('#dc3545') .alignSelf(ItemAlign.Start) Scroll() { Column({ space: 8 }) { ForEach(this.importResult.errors, (error: ImportError) => { Text(`行${error.row}: ${error.error}`) .fontSize(14) .fontColor('#dc3545') .alignSelf(ItemAlign.Start) }) } .width('100%') .alignItems(HorizontalAlign.Start) } .height('200vp') .width('100%') } .width('100%') .padding(16) .backgroundColor('#fff5f5') .borderRadius(12) } Row({ space: 12 }) { Button('重新导入') .type(ButtonType.Normal) .fontSize(16) .fontColor('#4ECDC4') .backgroundColor('#f0fffe') .border({ width: 1, color: '#4ECDC4' }) .borderRadius(8) .layoutWeight(1) .onClick(() => { this.resetImportResult(); }) Button('完成') .fontSize(16) .fontColor('#ffffff') .backgroundColor('#4ECDC4') .borderRadius(8) .layoutWeight(1) .onClick(() => { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Import completed, navigating to ContactsPage...'); router.replaceUrl({ url: 'pages/ContactsPage' }); }) } .width('100%') } .width('100%') .padding(16) .justifyContent(FlexAlign.Center) .height('100%') } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L683-L767
a2a4caa31702cdfb3f488738e49583f1f141922f
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets
arkts
loadKey
加载私钥文件内容
loadKey() { try { this.privateKey = this.readStringFromFile(keyFileUri) this.keyLoaded = true } catch (e) { this.msgHistory += 'readText failed ' + e.message + "\r\n"; } }
AST#method_declaration#Left loadKey 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . privateKey AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readStringFromFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyFileUri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keyLoaded AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'readText failed ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
loadKey() { try { this.privateKey = this.readStringFromFile(keyFileUri) this.keyLoaded = true } catch (e) { this.msgHistory += 'readText failed ' + e.message + "\r\n"; } }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L320-L328
9b77712fe698ab7742f657338150e6dc1abaa561
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets
arkts
省、市、区共用的地址列表类
export class CommonAddressList { code: string; // 存放省、市、区id name: string; // 存放省、市、区名 constructor(code: string = '', name: string = '') { this.code = code; this.name = name; } }
AST#export_declaration#Left export AST#class_declaration#Left class CommonAddressList AST#class_body#Left { AST#property_declaration#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 存放省、市、区id AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 存放省、市、区名 AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . code AST#member_expression#Right = AST#expression#Left code AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . name AST#member_expression#Right = AST#expression#Left name AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommonAddressList { code: string; name: string; constructor(code: string = '', name: string = '') { this.code = code; this.name = name; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L19-L27
efb33951f99e45d4d1765e41009d230e2089d869
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets
arkts
getFirstDayData
周视图切换时,将当前周数据的第一天(周日)日期数据传出去
getFirstDayData() { if (this.weekDays && this.weekDays[0][0].dayInfo) { this.onWeekSwitch({ date: this.weekDays[0][0].dayInfo.date, month: this.weekDays[0][0].dayInfo.month, year: this.weekDays[0][0].dayInfo.year }) } }
AST#method_declaration#Left getFirstDayData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weekDays AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . weekDays AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onWeekSwitch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left date AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weekDays AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left month AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weekDays AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left year AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weekDays AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . dayInfo AST#member_expression#Right AST#expression#Right . year AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
getFirstDayData() { if (this.weekDays && this.weekDays[0][0].dayInfo) { this.onWeekSwitch({ date: this.weekDays[0][0].dayInfo.date, month: this.weekDays[0][0].dayInfo.month, year: this.weekDays[0][0].dayInfo.year }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets#L61-L69
d2d0691e80213af81c59af7a3ead9deed43411ea
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets
arkts
getX
returns the x-value of the highlighted value @return
public getX(): number { return this.mX; }
AST#method_declaration#Left public getX AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mX AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getX(): number { return this.mX; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets#L105-L107
040d699c75787a57f6fb85f0453b11e46fbf4875
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/AvatarComponent.ets
arkts
getEmotionOpacity
根据状态返回透明度
private getEmotionOpacity(): number { if (this.isThinking) { return 0.85; // 思考时稍微透明 } return 1.0; }
AST#method_declaration#Left private getEmotionOpacity 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#Left AST#expression#Left this AST#expression#Right . isThinking AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 0.85 AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 思考时稍微透明 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 1.0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getEmotionOpacity(): number { if (this.isThinking) { return 0.85; } return 1.0; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/AvatarComponent.ets#L584-L589
811b3ce12c58e2d97743af91d7e1fd997966f067
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets
arkts
aboutToAppear
右下列表横向滚动到的第一个listItem索引号
aboutToAppear(): void { // 加载数据 this.loadShowData(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 加载数据 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadShowData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear(): void { this.loadShowData(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L53-L56
4389457faf8b651bcb59134acceec9b74e3f60d8
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/common/utils/Logger.ets
arkts
debug
Outputs debug-level logs. @param args Indicates the log parameters.
debug(...args: string[]) { hilog.debug(this.domain, this.prefix, this.format, args); }
AST#method_declaration#Left debug AST#parameter_list#Left ( AST#parameter#Left ... args : 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#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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . domain AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . prefix AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . format AST#member_expression#Right AST#expression#Right , AST#expression#Left args AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
debug(...args: string[]) { hilog.debug(this.domain, this.prefix, this.format, args); }
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/common/utils/Logger.ets#L38-L40
1489fbbe994fb07684d5ed1d9cf65a7790e4454c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionParameter.ets
arkts
initAlertTitle
Alert标题,初始化参数 @param options
static initAlertTitle(options: AlertOptions | CustomContentOptions | BaseInputOptions) { if (options.primaryTitle || options.title) { options.primaryTitle = options.primaryTitle ?? options.title; //弹框一级标题。 } }
AST#method_declaration#Left static initAlertTitle AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AlertOptions AST#primary_type#Right | AST#primary_type#Left CustomContentOptions AST#primary_type#Right | AST#primary_type#Left BaseInputOptions AST#primary_type#Right AST#union_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_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . primaryTitle AST#member_expression#Right AST#expression#Right || AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . primaryTitle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . primaryTitle AST#member_expression#Right AST#expression#Right ?? AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //弹框一级标题。 } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
static initAlertTitle(options: AlertOptions | CustomContentOptions | BaseInputOptions) { if (options.primaryTitle || options.title) { options.primaryTitle = options.primaryTitle ?? options.title; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L277-L281
e0f3dd69ae28c4126794938fb1ae290a5dfaf9f7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets
arkts
sendData
发送数据 @param data @param address @param port
async sendData(data: string, address: string, port: number): Promise<void> { let options: socket.UDPSendOptions = { address: { address: address, port: port, family: 1, }, data: data, }; if (!this.udpSocket) { return; } Logger.info(`${TAG} tls sendData data ${JSON.stringify(data)}`); try { await this.udpSocket.send(options); } catch (e) { Logger.error(`${TAG} tls sendData error ${JSON.stringify(e)}}`); } }
AST#method_declaration#Left async sendData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left port : 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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . UDPSendOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left address AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left port AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left family AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left data AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . udpSocket AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tls sendData data AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . udpSocket AST#member_expression#Right AST#expression#Right . send AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tls sendData error AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right } ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async sendData(data: string, address: string, port: number): Promise<void> { let options: socket.UDPSendOptions = { address: { address: address, port: port, family: 1, }, data: data, }; if (!this.udpSocket) { return; } Logger.info(`${TAG} tls sendData data ${JSON.stringify(data)}`); try { await this.udpSocket.send(options); } catch (e) { Logger.error(`${TAG} tls sendData error ${JSON.stringify(e)}}`); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets#L69-L88
da8c7a5fcc8ec7cf759f80835858832b0bb25baa
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/utils/FuncUtils.ets
arkts
计算旋转角度 @param angle {number} 旋转角度 @returns {number} 最终需要旋转的角度
export function simplestRotationQuarter(angle: number): number { // 一个完整的圆的角度是360度 const FULL_CIRCLE: number = 360; // 每个象限的角度是90度 const QUADRANT_DEGREES: number = 90; // 为了正确处理角度在象限边界的情况,使用44.5作为偏移量。 // 这个值是为了确保当角度正好处于两个象限的边界上时(如45, 135, 225, 315度),它会被归入正确的象限。 const BOUNDARY_OFFSET: number = 44.5; // 将角度限制在360度内 let normalizedAngle: number = angle % FULL_CIRCLE; // 确定象限 const QUADRANT: number = Math.floor((Math.abs(normalizedAngle) + BOUNDARY_OFFSET) / QUADRANT_DEGREES) % 4; // 根据象限确定旋转角度 const standardRotations: number[] = [0, 90, 180, 270]; let rotation = standardRotations[QUADRANT]; // 保持原始角度的方向 let finalRotation = rotation * (angle >= 0 ? 1 : -1); // 返回最终的简化旋转角度 return finalRotation || 0; }
AST#export_declaration#Left export AST#function_declaration#Left function simplestRotationQuarter 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#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 一个完整的圆的角度是360度 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left FULL_CIRCLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 360 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 每个象限的角度是90度 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left QUADRANT_DEGREES : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 90 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 为了正确处理角度在象限边界的情况,使用44.5作为偏移量。 // 这个值是为了确保当角度正好处于两个象限的边界上时(如45, 135, 225, 315度),它会被归入正确的象限。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left BOUNDARY_OFFSET : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 44.5 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 将角度限制在360度内 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left normalizedAngle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left angle AST#expression#Right % AST#expression#Left FULL_CIRCLE AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 确定象限 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left QUADRANT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left normalizedAngle AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left BOUNDARY_OFFSET AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left QUADRANT_DEGREES AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right % AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 根据象限确定旋转角度 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left standardRotations : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 90 AST#expression#Right , AST#expression#Left 180 AST#expression#Right , AST#expression#Left 270 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rotation = AST#expression#Left AST#subscript_expression#Left AST#expression#Left standardRotations AST#expression#Right [ AST#expression#Left QUADRANT AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 保持原始角度的方向 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left finalRotation = AST#expression#Left AST#binary_expression#Left AST#expression#Left rotation AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left angle AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 返回最终的简化旋转角度 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left finalRotation AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function simplestRotationQuarter(angle: number): number { const FULL_CIRCLE: number = 360; const QUADRANT_DEGREES: number = 90; const BOUNDARY_OFFSET: number = 44.5; let normalizedAngle: number = angle % FULL_CIRCLE; const QUADRANT: number = Math.floor((Math.abs(normalizedAngle) + BOUNDARY_OFFSET) / QUADRANT_DEGREES) % 4; const standardRotations: number[] = [0, 90, 180, 270]; let rotation = standardRotations[QUADRANT]; let finalRotation = rotation * (angle >= 0 ? 1 : -1); return finalRotation || 0; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/utils/FuncUtils.ets#L38-L62
f151314afaef1466c4e835c696a2dc1457656302
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DialogUtils.ets
arkts
initPrimaryButton
两个按钮,初始化参数 @param options
private static initPrimaryButton(options: PrimaryDialogOptions) { //当PrimaryButton和SecondaryButton同时为空时,使用默认按钮 if (!options.primaryButton && !options.secondaryButton) { options.primaryButton = DialogUtils.defaultConfig.primaryButton options.secondaryButton = DialogUtils.defaultConfig.secondaryButton } if (options.primaryButton) { let primaryValue = options.primaryButton; if (Tools.isResourceStr(primaryValue)) { options.primaryButton = { value: primaryValue as ResourceStr, action: () => { if (options.onAction) { options.onAction(DialogAction.ONE); } } } } else { let primaryButton = options.primaryButton as ButtonOptions; let primaryAction = primaryButton.action; primaryButton.action = () => { if (options.onAction) { options.onAction(DialogAction.ONE); } if (primaryAction) { primaryAction(); } } } } if (options.secondaryButton) { let secondaryValue = options.secondaryButton; if (Tools.isResourceStr(secondaryValue)) { options.secondaryButton = { value: secondaryValue as ResourceStr, action: () => { if (options.onAction) { options.onAction(DialogAction.TWO); } } } } else { let secondaryButton = options.secondaryButton as ButtonOptions; let secondaryAction = secondaryButton.action; secondaryButton.action = () => { if (options.onAction) { options.onAction(DialogAction.TWO); } if (secondaryAction) { secondaryAction(); } } } } }
AST#method_declaration#Left private static initPrimaryButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left PrimaryDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { //当PrimaryButton和SecondaryButton同时为空时,使用默认按钮 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . primaryButton AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . secondaryButton AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . primaryButton AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogUtils AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . primaryButton AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . secondaryButton AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogUtils AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . secondaryButton AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . primaryButton AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primaryValue = AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . primaryButton AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tools AST#expression#Right . isResourceStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left primaryValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . primaryButton AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left primaryValue AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAction AST#expression#Right . ONE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primaryButton = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . primaryButton AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left primaryAction = AST#expression#Left AST#member_expression#Left AST#expression#Left primaryButton AST#expression#Right . action AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left primaryButton AST#expression#Right . action AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAction AST#expression#Right . ONE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left primaryAction AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left primaryAction AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . secondaryButton AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left secondaryValue = AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . secondaryButton AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tools AST#expression#Right . isResourceStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left secondaryValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . secondaryButton AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left secondaryValue AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAction AST#expression#Right . TWO AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left secondaryButton = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . secondaryButton AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left secondaryAction = AST#expression#Left AST#member_expression#Left AST#expression#Left secondaryButton AST#expression#Right . action AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left secondaryButton AST#expression#Right . action AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAction AST#expression#Right . TWO AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left secondaryAction AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left secondaryAction AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
private static initPrimaryButton(options: PrimaryDialogOptions) { if (!options.primaryButton && !options.secondaryButton) { options.primaryButton = DialogUtils.defaultConfig.primaryButton options.secondaryButton = DialogUtils.defaultConfig.secondaryButton } if (options.primaryButton) { let primaryValue = options.primaryButton; if (Tools.isResourceStr(primaryValue)) { options.primaryButton = { value: primaryValue as ResourceStr, action: () => { if (options.onAction) { options.onAction(DialogAction.ONE); } } } } else { let primaryButton = options.primaryButton as ButtonOptions; let primaryAction = primaryButton.action; primaryButton.action = () => { if (options.onAction) { options.onAction(DialogAction.ONE); } if (primaryAction) { primaryAction(); } } } } if (options.secondaryButton) { let secondaryValue = options.secondaryButton; if (Tools.isResourceStr(secondaryValue)) { options.secondaryButton = { value: secondaryValue as ResourceStr, action: () => { if (options.onAction) { options.onAction(DialogAction.TWO); } } } } else { let secondaryButton = options.secondaryButton as ButtonOptions; let secondaryAction = secondaryButton.action; secondaryButton.action = () => { if (options.onAction) { options.onAction(DialogAction.TWO); } if (secondaryAction) { secondaryAction(); } } } } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L262-L316
1ac23032da0a657e8f447f6dd5e8801fe08d623c
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/timeto/TimeToManager.ets
arkts
getLastResultByName
获取指定 typeName 的上次执行结果
public static getLastResultByName(typeName: string): boolean | undefined { try { const prefs = TimeToManager._getPrefs(); const raw = prefs.getSync(TimeToKeys.lastResult(typeName), null); if (raw === null || raw === undefined) { return undefined; } if (typeof raw === 'boolean') { return raw; } if (typeof raw === 'string') { return raw.toLowerCase() === 'true'; } return undefined; } catch (err) { DebugLog.d(`getLastResultByName error: ${err}`); return undefined; } }
AST#method_declaration#Left public static getLastResultByName AST#parameter_list#Left ( AST#parameter#Left typeName : 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#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left prefs = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeToManager AST#expression#Right . _getPrefs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left raw = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prefs AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeToKeys AST#expression#Right . lastResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left typeName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left raw AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left raw AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left raw AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'boolean' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left raw AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left raw AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left raw AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left 'true' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` getLastResultByName error: AST#template_substitution#Left $ { AST#expression#Left err AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static getLastResultByName(typeName: string): boolean | undefined { try { const prefs = TimeToManager._getPrefs(); const raw = prefs.getSync(TimeToKeys.lastResult(typeName), null); if (raw === null || raw === undefined) { return undefined; } if (typeof raw === 'boolean') { return raw; } if (typeof raw === 'string') { return raw.toLowerCase() === 'true'; } return undefined; } catch (err) { DebugLog.d(`getLastResultByName error: ${err}`); return undefined; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/timeto/TimeToManager.ets#L92-L114
84971def0c9c195986d110e35a31ae0cdf60b8dc
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsCommentsCard.ets
arkts
GoodsCommentsCard
@file 商品评论卡片组件 @author Joker.X
@ComponentV2 export struct GoodsCommentsCard { /** * 评论列表 */ @Param comments: Comment[] = []; /** * 点击查看全部回调 */ @Param onTap: (() => void) | undefined = undefined; /** * 构建商品评论卡片 * @returns {void} 无返回值 */ build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium"), } }) { Card({ widthValue: P100, radiusValue: $r("app.float.radius_medium") }) { ColumnStart({ widthValue: P100 }) { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ value: "查看全部", isLink: true, clickable: this.onTap !== undefined, onCellClick: (): void => this.handleTap(), titleBuilder: (): void => this.buildTitle(), }); } SpaceVerticalSmall(); ForEach(this.comments, (comment: Comment, index: number): void => { CommentItem({ comment }); if (index < this.comments.length - 1) { IBestDivider() } }, (comment: Comment, index: number): string => `${comment.id}-${index}`); } } } } /** * 构建标题区域 * @returns {void} 无返回值 */ @Builder private buildTitle(): void { TitleWithLine({ text: $r("app.string.goods_reviews") }); } /** * 处理点击事件 * @returns {void} 无返回值 */ private handleTap(): void { if (this.onTap) { this.onTap(); } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsCommentsCard AST#component_body#Left { /** * 评论列表 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right comments : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 点击查看全部回调 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onTap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left 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#function_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /** * 构建商品评论卡片 * @returns {void} 无返回值 */ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_horizontal_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_horizontal_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left radiusValue : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.radius_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestCellGroup ( AST#component_parameters#Left { AST#component_parameter#Left inset : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left radius : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.radius_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left outerMargin : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left IBestCell ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left "查看全部" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLink : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left clickable : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onCellClick : AST#expression#Left AST#arrow_function#Left 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleTap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left titleBuilder : AST#expression#Left AST#arrow_function#Left 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_custom_component_statement#Left SpaceVerticalSmall ( ) ; AST#ui_custom_component_statement#Right AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . comments AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left comment : AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#ui_arrow_function_body#Left { AST#ui_custom_component_statement#Left CommentItem ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left comment AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . comments AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestDivider ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left comment : AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 string AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left comment AST#expression#Right . id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left index AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right /** * 构建标题区域 * @returns {void} 无返回值 */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildTitle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left TitleWithLine ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.goods_reviews" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 处理点击事件 * @returns {void} 无返回值 */ AST#method_declaration#Left private handleTap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct GoodsCommentsCard { @Param comments: Comment[] = []; @Param onTap: (() => void) | undefined = undefined; build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium"), } }) { Card({ widthValue: P100, radiusValue: $r("app.float.radius_medium") }) { ColumnStart({ widthValue: P100 }) { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ value: "查看全部", isLink: true, clickable: this.onTap !== undefined, onCellClick: (): void => this.handleTap(), titleBuilder: (): void => this.buildTitle(), }); } SpaceVerticalSmall(); ForEach(this.comments, (comment: Comment, index: number): void => { CommentItem({ comment }); if (index < this.comments.length - 1) { IBestDivider() } }, (comment: Comment, index: number): string => `${comment.id}-${index}`); } } } } @Builder private buildTitle(): void { TitleWithLine({ text: $r("app.string.goods_reviews") }); } private handleTap(): void { if (this.onTap) { this.onTap(); } } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsCommentsCard.ets#L11-L86
cc955c6bbda8dee28b895c84319cca3f5a29ac39
github