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
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/router/Router.ets
arkts
push
Push 跳转
async push(path: string, params?: RouteParams): Promise<void> { const route = this.routes.get(path) || { path: path, name: '', params: params }; // 执行路由守卫 const canNavigate = await this.executeGuards(route); if (!canNavigate) { Logger.warn('Router', `Navigation blocked by guard for: ${path}`); return; } // 转换路径格式:/pages/Login -> pages/Login(与 main_pages.json 和 loadContent 完全一致) let cleanPath = path.startsWith('/pages/') ? path.substring(1) : path; cleanPath = cleanPath.startsWith('/') ? cleanPath.substring(1) : cleanPath; // 确保路径以 pages/ 开头(与 main_pages.json 配置一致) if (!cleanPath.startsWith('pages/')) { cleanPath = `pages/${cleanPath}`; } // 提取页面名称(用于备用方案) const pageName = cleanPath.startsWith('pages/') ? cleanPath.substring(6) : cleanPath; // 尝试多种 URL 格式,找到能工作的那个 const urlFormats = [ cleanPath, // pages/Login(与 main_pages.json 一致) pageName, // Login(页面名称) ]; let lastError: Error | null = null; for (const urlFormat of urlFormats) { try { const url = params ? `${urlFormat}?${this.buildQueryString(params)}` : urlFormat; Logger.info('Router', `Trying push with URL: "${url}" (format: ${urlFormat === cleanPath ? 'full path' : 'page name'})`); await router.pushUrl({ url: url }); Logger.info('Router', `Successfully pushed to: ${path} using URL: "${url}"`); return; // 成功则返回 } catch (error) { lastError = error as Error; Logger.warn('Router', `Failed with URL "${urlFormat}": ${String(error)}`); // 继续尝试下一个格式 } } // 所有格式都失败了 Logger.error('Router', `All URL formats failed for ${path}`); throw lastError || new Error(`Push navigation failed for ${path}`); }
AST#method_declaration#Left async push AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params ? : AST#type_annotation#Left AST#primary_type#Left RouteParams 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 const AST#variable_declarator#Left route = 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 this AST#expression#Right . routes AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left path AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left params AST#expression#Right AST#property_assignment#Right } AST#object_literal#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#variable_declaration#Left const AST#variable_declarator#Left canNavigate = 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 . executeGuards AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left route 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#unary_expression#Left ! AST#expression#Left canNavigate AST#expression#Right AST#unary_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 . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Router' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Navigation blocked by guard for: AST#template_substitution#Left $ { AST#expression#Left path 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 转换路径格式:/pages/Login -> pages/Login(与 main_pages.json 和 loadContent 完全一致) AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cleanPath = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left path AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '/pages/' AST#expression#Right ) 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 path AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left path 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleanPath = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleanPath AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '/' AST#expression#Right ) 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 cleanPath AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left cleanPath AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 确保路径以 pages/ 开头(与 main_pages.json 配置一致) 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 cleanPath AST#expression#Right AST#unary_expression#Right AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pages/' 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 cleanPath = AST#expression#Left AST#template_literal#Left ` pages/ AST#template_substitution#Left $ { AST#expression#Left cleanPath AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#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 const AST#variable_declarator#Left pageName = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleanPath AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pages/' AST#expression#Right ) 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 cleanPath AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 6 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left cleanPath AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 尝试多种 URL 格式,找到能工作的那个 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left urlFormats = AST#expression#Left AST#array_literal#Left [ AST#expression#Left cleanPath AST#expression#Right , // pages/Login(与 main_pages.json 一致) AST#expression#Left pageName AST#expression#Right , // Login(页面名称) ] 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 lastError : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Error 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const urlFormat of AST#expression#Left urlFormats AST#expression#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 url = AST#expression#Left AST#conditional_expression#Left AST#expression#Left params AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left urlFormat AST#expression#Right } AST#template_substitution#Right ? AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildQueryString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params 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#expression#Left urlFormat 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#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 'Router' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Trying push with URL: " AST#template_substitution#Left $ { AST#expression#Left url AST#expression#Right } AST#template_substitution#Right " (format: AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left urlFormat AST#expression#Right === AST#expression#Left cleanPath AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 'full path' AST#expression#Right : AST#expression#Left 'page name' AST#expression#Right AST#conditional_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#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 router AST#expression#Right AST#await_expression#Right AST#expression#Right . pushUrl 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 url 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#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 'Router' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Successfully pushed to: AST#template_substitution#Left $ { AST#expression#Left path AST#expression#Right } AST#template_substitution#Right using URL: " AST#template_substitution#Left $ { AST#expression#Left url 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#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#assignment_expression#Left lastError = 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#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 . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Router' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed with URL " AST#template_substitution#Left $ { AST#expression#Left urlFormat AST#expression#Right } AST#template_substitution#Right ": AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left String 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#block_statement#Right AST#catch_clause#Right AST#try_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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Router' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` All URL formats failed for AST#template_substitution#Left $ { AST#expression#Left path 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#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left lastError AST#expression#Right || AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Push navigation failed for AST#template_substitution#Left $ { AST#expression#Left path 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#method_declaration#Right
async push(path: string, params?: RouteParams): Promise<void> { const route = this.routes.get(path) || { path: path, name: '', params: params }; const canNavigate = await this.executeGuards(route); if (!canNavigate) { Logger.warn('Router', `Navigation blocked by guard for: ${path}`); return; } let cleanPath = path.startsWith('/pages/') ? path.substring(1) : path; cleanPath = cleanPath.startsWith('/') ? cleanPath.substring(1) : cleanPath; if (!cleanPath.startsWith('pages/')) { cleanPath = `pages/${cleanPath}`; } const pageName = cleanPath.startsWith('pages/') ? cleanPath.substring(6) : cleanPath; const urlFormats = [ cleanPath, pageName, ]; let lastError: Error | null = null; for (const urlFormat of urlFormats) { try { const url = params ? `${urlFormat}?${this.buildQueryString(params)}` : urlFormat; Logger.info('Router', `Trying push with URL: "${url}" (format: ${urlFormat === cleanPath ? 'full path' : 'page name'})`); await router.pushUrl({ url: url }); Logger.info('Router', `Successfully pushed to: ${path} using URL: "${url}"`); return; } catch (error) { lastError = error as Error; Logger.warn('Router', `Failed with URL "${urlFormat}": ${String(error)}`); } } Logger.error('Router', `All URL formats failed for ${path}`); throw lastError || new Error(`Push navigation failed for ${path}`); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Router.ets#L105-L154
0e6ac6a3844fbc6cdfbbb6a2a6dc14ab211109aa
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
快捷方式配置接口
export interface ShortcutConfig { id: string; type: ShortcutType; label: string; description: string; icon: string; targetPage: string; params?: Record<string, any>; isStatic?: boolean; priority: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ShortcutConfig AST#object_type#Left { AST#type_member#Left id : 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 type : AST#type_annotation#Left AST#primary_type#Left ShortcutType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left label : 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 description : 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 icon : 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 targetPage : 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 params ? : 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 any 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_member#Right ; AST#type_member#Left isStatic ? : 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 priority : AST#type_annotation#Left AST#primary_type#Left number 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 ShortcutConfig { id: string; type: ShortcutType; label: string; description: string; icon: string; targetPage: string; params?: Record<string, any>; isStatic?: boolean; priority: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L28-L38
52b8297aca780ce03b42f5020ebb2674106f3b81
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets
arkts
getAllRecordSounds
获取所有录音记录 @returns RecordSound 数组或 null
async getAllRecordSounds(): Promise<RecordSound[] | null> { if (!this.db) return null; const sql = `SELECT * FROM ${Tables.Record.name}`; return await this.db.getDatas(sql, [], rs => this.createRecordSoundFromRs(rs)); }
AST#method_declaration#Left async getAllRecordSounds 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#union_type#Left AST#primary_type#Left AST#array_type#Left RecordSound [ ] 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#type_arguments#Right AST#generic_type#Right 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . db AST#member_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 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sql = AST#expression#Left AST#template_literal#Left ` SELECT * FROM AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Record AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_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 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 . db AST#member_expression#Right AST#expression#Right . getDatas AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left rs => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createRecordSoundFromRs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs 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
async getAllRecordSounds(): Promise<RecordSound[] | null> { if (!this.db) return null; const sql = `SELECT * FROM ${Tables.Record.name}`; return await this.db.getDatas(sql, [], rs => this.createRecordSoundFromRs(rs)); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L142-L149
766af7c7f7456fdef4c571d20080f4166cbb6683
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets
arkts
getData
Retrieve data at the specified index.
public getData(index: number): void { }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
public getData(index: number): void { }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets#L26-L27
61b71e35b36bd03adfc55792319b2ff857791123
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/bigfolder/src/main/ets/default/view/FolderOpenComponent.ets
arkts
setStartAppInfo
set start app info
setStartAppInfo() { if (CheckEmptyUtils.isEmpty(this.item)) { Log.showError(TAG, 'setStartAppInfo with item') return; } Log.showInfo(TAG, 'app setStartAppInfo'); if (AppStorage.get('deviceType') === CommonConstants.PAD_DEVICE_TYPE) { AppStorage.setOrCreate('openFolderStatus', BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE); } AppStorage.setOrCreate('startAppItemInfo', this.item); mBigFolderStartAppHandler.setAppIconSize(mBigFolderStyleConfig.mOpenFolderIconSize); mBigFolderStartAppHandler.setAppIconInfo(); }
AST#method_declaration#Left setStartAppInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CheckEmptyUtils AST#expression#Right . isEmpty 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 . item 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'setStartAppInfo with item' 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'app setStartAppInfo' 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'deviceType' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAD_DEVICE_TYPE 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 AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'openFolderStatus' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left BigFolderConstants AST#expression#Right . OPEN_FOLDER_STATUS_CLOSE 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'startAppItemInfo' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item 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 mBigFolderStartAppHandler AST#expression#Right . setAppIconSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left mBigFolderStyleConfig AST#expression#Right . mOpenFolderIconSize 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 mBigFolderStartAppHandler AST#expression#Right . setAppIconInfo 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
setStartAppInfo() { if (CheckEmptyUtils.isEmpty(this.item)) { Log.showError(TAG, 'setStartAppInfo with item') return; } Log.showInfo(TAG, 'app setStartAppInfo'); if (AppStorage.get('deviceType') === CommonConstants.PAD_DEVICE_TYPE) { AppStorage.setOrCreate('openFolderStatus', BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE); } AppStorage.setOrCreate('startAppItemInfo', this.item); mBigFolderStartAppHandler.setAppIconSize(mBigFolderStyleConfig.mOpenFolderIconSize); mBigFolderStartAppHandler.setAppIconInfo(); }
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/bigfolder/src/main/ets/default/view/FolderOpenComponent.ets#L645-L657
587acc013d0d51fd9fa5fb591799a0e1acf79357
gitee
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/model/data/SessionData.ets
arkts
主界面会话列表的数据结构
export class SessionData{ wid: string //用户wid headImg: string //头像 name: string //用户昵称 lastMsg: string //最后一条消息简要内容 unReadMsg: number //未读消息数量 constructor
AST#export_declaration#Left export AST#ERROR#Left class SessionData { wid : AST#ERROR#Left string //用户wid headImg : string //头像 name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right //用户昵称 AST#ERROR#Left l as tMsg AST#ERROR#Right : string //最后一条消息简要内容 unReadMsg : AST#ERROR#Right number AST#ERROR#Right //未读消息数量 AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class SessionData{ wid: string headImg: string name: string lastMsg: string unReadMsg: number constructor
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/data/SessionData.ets#L5-L12
35a15cd22aa737d702466eb870115c8a73a99b75
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
encodeCBC
加密-CBC模式 @param str 待加密的字符串 @param key 给定秘钥规格密钥 @param iv iv偏移量字符串 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param resultCoding 返回结果编码方式(hex/base64) @returns
static encodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding): string { //转换key let symKey = CryptoSyncUtil.convertKeyFromStr(key, symAlgName, keyName, keyCoding); // 初始化加解密操作环境 let mode = crypto.CryptoMode.ENCRYPT_MODE; //创建加密器 let cipher = crypto.createCipher(symEncryptName); //初始化加密 cipher.initSync(mode, symKey, CryptoSyncUtil.genIvParamsSpec(iv, keyCoding)); //封装加密所需数据 let encode = new util.TextEncoder(); //开始加密 let updateOutput = cipher.doFinalSync({ data: encode.encodeInto(str) }); //转换字符串 return StrAndUintUtil.unitArray2StrCoding(updateOutput.data, resultCoding); }
AST#method_declaration#Left static encodeCBC 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 key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symEncryptName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyName : AST#type_annotation#Left AST#primary_type#Left number 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 resultCoding : 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //转换key AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . convertKeyFromStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left symAlgName AST#expression#Right , AST#expression#Left keyName AST#expression#Right , AST#expression#Left keyCoding 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 mode = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . ENCRYPT_MODE 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 cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symEncryptName 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 cipher AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mode AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . genIvParamsSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left iv AST#expression#Right , AST#expression#Left keyCoding 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#variable_declaration#Left let AST#variable_declarator#Left encode = 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 util AST#expression#Right AST#new_expression#Right AST#expression#Right . TextEncoder 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 updateOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipher AST#expression#Right . doFinalSync 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 data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left encode AST#expression#Right . encodeInto AST#member_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 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2StrCoding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updateOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding 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 encodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding): string { let symKey = CryptoSyncUtil.convertKeyFromStr(key, symAlgName, keyName, keyCoding); let mode = crypto.CryptoMode.ENCRYPT_MODE; let cipher = crypto.createCipher(symEncryptName); cipher.initSync(mode, symKey, CryptoSyncUtil.genIvParamsSpec(iv, keyCoding)); let encode = new util.TextEncoder(); let updateOutput = cipher.doFinalSync({ data: encode.encodeInto(str) }); return StrAndUintUtil.unitArray2StrCoding(updateOutput.data, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L157-L173
be8729978bed8d5a7bc62fb9d4381e21fcd9f14b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/VoiceService.ets
arkts
initializeSpeechRecognition
初始化语音识别
private async initializeSpeechRecognition(): Promise<void> { try { this.recognizer = await speechRecognizer.createRecognizer({ language: 'zh-CN', continuous: false, interimResults: true }); // 设置识别事件监听 this.recognizer.on('result', (result) => { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Recognition result: ${result.text}`); }); this.recognizer.on('error', (error) => { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Recognition error: ${error}`); }); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Speech recognition initialized'); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize speech recognition: ${error}`); } }
AST#method_declaration#Left private async initializeSpeechRecognition 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 { 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 . recognizer 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 speechRecognizer AST#expression#Right AST#await_expression#Right AST#expression#Right . createRecognizer 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 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 continuous AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left interimResults 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#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 . recognizer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'result' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result 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 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 ` Recognition result: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . text 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#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 . recognizer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'error' AST#expression#Right , 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 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 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 ` Recognition error: 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#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#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 'Speech recognition initialized' 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#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 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 ` Failed to initialize speech recognition: 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async initializeSpeechRecognition(): Promise<void> { try { this.recognizer = await speechRecognizer.createRecognizer({ language: 'zh-CN', continuous: false, interimResults: true }); this.recognizer.on('result', (result) => { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Recognition result: ${result.text}`); }); this.recognizer.on('error', (error) => { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Recognition error: ${error}`); }); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Speech recognition initialized'); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize speech recognition: ${error}`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L146-L167
4eaf77858ac1a10116850c9874510f80c76264e7
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
stringToUnit8Array
可理解的字符串转成字节流 @param str 字符串 @param str 字符串C1C3C2格式的,true为是 @returns Uint8Array字节流
static stringToUnit8Array(str: string, isC1C3C2?: boolean): Uint8Array { // if (isC1C3C2) { // str = new SM2Convert().i2dSM2(str); // } let arr = Array<number>(); for (let i = 0, j = str.length; i < j; ++i) { arr.push(str.charCodeAt(i)); } return new Uint8Array(arr); }
AST#method_declaration#Left static stringToUnit8Array 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 isC1C3C2 ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // if (isC1C3C2) { // str = new SM2Convert().i2dSM2(str); // } AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left arr = AST#expression#Left AST#call_expression#Left AST#expression#Left Array 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#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#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_declarator#Left j = AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left j AST#expression#Right AST#binary_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr 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#member_expression#Left AST#expression#Left str AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i 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#for_statement#Right AST#statement#Right 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 Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left arr 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 stringToUnit8Array(str: string, isC1C3C2?: boolean): Uint8Array { let arr = Array<number>(); for (let i = 0, j = str.length; i < j; ++i) { arr.push(str.charCodeAt(i)); } return new Uint8Array(arr); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L219-L228
fd4b5ff33899f0418d2e6aed9e533ffe43fdc030
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets
arkts
城市列表项视图 @param alphabetListItem: 列表项数据 @param contentBuilder: 列表项视图
export class AlphabetListItemView { alphabetListItem: AlphabetListItemType; contentBuilder: WrappedBuilder<[string]>; constructor(alphabetListItem: AlphabetListItemType, contentBuilder: WrappedBuilder<[string]>) { this.alphabetListItem = alphabetListItem; this.contentBuilder = contentBuilder; } }
AST#export_declaration#Left export AST#class_declaration#Left class AlphabetListItemView AST#class_body#Left { AST#property_declaration#Left alphabetListItem : AST#type_annotation#Left AST#primary_type#Left AlphabetListItemType AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left contentBuilder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_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#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left alphabetListItem : AST#type_annotation#Left AST#primary_type#Left AlphabetListItemType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contentBuilder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_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#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 . alphabetListItem AST#member_expression#Right = AST#expression#Left alphabetListItem 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 . contentBuilder AST#member_expression#Right = AST#expression#Left contentBuilder 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 AlphabetListItemView { alphabetListItem: AlphabetListItemType; contentBuilder: WrappedBuilder<[string]>; constructor(alphabetListItem: AlphabetListItemType, contentBuilder: WrappedBuilder<[string]>) { this.alphabetListItem = alphabetListItem; this.contentBuilder = contentBuilder; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets#L52-L60
962014227643cb00aa06fff4dd81eea1ca1bf88e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBus.ets
arkts
off
注销事件监听 @param eventName 事件名 @param handler 监听回调;不传handler,注销eventName的所有事件监听
static off(eventName: string, handler?: Function): void { EventBusCore.getInstance().off(eventName, handler); }
AST#method_declaration#Left static off AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler ? : 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBusCore 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 . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left eventName AST#expression#Right , AST#expression#Left handler 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 off(eventName: string, handler?: Function): void { EventBusCore.getInstance().off(eventName, handler); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBus.ets#L34-L36
a1998f41eb44110f76e357ec445447ed7becec10
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Vibrator/Vibrator.ets
arkts
vibratePreset
预设效果振动 @param effectId 系统预设效果ID,默认'haptic.click'
vibratePreset(effectId: string = 'haptic.click'): void { vibrator.isSupportEffect(effectId, (err: BusinessError, state: boolean) => { if (!err && state) { vibrator.startVibration( { type: 'preset', effectId }, { usage: 'touch' } ); } }); }
AST#method_declaration#Left vibratePreset AST#parameter_list#Left ( AST#parameter#Left effectId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'haptic.click' AST#expression#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 vibrator AST#expression#Right . isSupportEffect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left effectId AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left state : 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left err AST#expression#Right AST#unary_expression#Right AST#expression#Right && AST#expression#Left state 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 vibrator AST#expression#Right . startVibration 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 'preset' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left effectId 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 usage AST#property_name#Right : AST#expression#Left 'touch' 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#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 ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
vibratePreset(effectId: string = 'haptic.click'): void { vibrator.isSupportEffect(effectId, (err: BusinessError, state: boolean) => { if (!err && state) { vibrator.startVibration( { type: 'preset', effectId }, { usage: 'touch' } ); } }); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Vibrator/Vibrator.ets#L49-L58
2a88e2693a04b573479393e8c57250a5e5a9b61f
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
Default fontSize_Large for texts. Usually used on sub titles. @returns 20
export function fontSize_Large() { return 20; }
AST#export_declaration#Left export AST#function_declaration#Left function fontSize_Large AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 20 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function fontSize_Large() { return 20; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L21-L23
2f889879f8a25ad15c1d7476d88556d383868bcc
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets
arkts
getPluralStringValueSync
同步返回单复数大写字符串string值
static getPluralStringValueSync(resource: Resource, num: number): string { if (!resource) { return ''; } try { let context = getContext() as common.UIAbilityContext; return context.resourceManager.getPluralStringValueSync(resource, num).toUpperCase(); } catch (error) { let code = (error as BusinessError).code; let message = (error as BusinessError).message; LogUtil.error(`getPluralStringValueSync failed,error code: ${code}, message:${message}.`); return ''; } }
AST#method_declaration#Left static getPluralStringValueSync AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left num : 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#unary_expression#Left ! AST#expression#Left resource 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#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#as_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 as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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 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 . getPluralStringValueSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resource AST#expression#Right , AST#expression#Left num AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toUpperCase 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#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 LogUtil AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` getPluralStringValueSync failed,error code: AST#template_substitution#Left $ { AST#expression#Left code AST#expression#Right } AST#template_substitution#Right , message: 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#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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getPluralStringValueSync(resource: Resource, num: number): string { if (!resource) { return ''; } try { let context = getContext() as common.UIAbilityContext; return context.resourceManager.getPluralStringValueSync(resource, num).toUpperCase(); } catch (error) { let code = (error as BusinessError).code; let message = (error as BusinessError).message; LogUtil.error(`getPluralStringValueSync failed,error code: ${code}, message:${message}.`); return ''; } }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/resourceUtils.ets#L57-L70
71a8aaedaee628754fbee0af7f0a0fe6152bc7f9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
isNull
判断对象是否为空 @param source @returns
static isNull(source: CommonAllType) { return source === null || source === undefined; }
AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left CommonAllType 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left source 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 source 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isNull(source: CommonAllType) { return source === null || source === undefined; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L75-L77
ccde21bd35b417902ce0b7b55a0a9166ab8617dc
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
getLoginInfo
获取当前用户的登录信息 @returns
getLoginInfo(): ILoginRegist | null { return this.loginInfo; }
AST#method_declaration#Left getLoginInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ILoginRegist 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 . loginInfo AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getLoginInfo(): ILoginRegist | null { return this.loginInfo; }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L54-L56
1571cceef3682327447c2412e0958db36d7fa2ff
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the feature (F) version number, which increases with any planned new features. <p>The F version number monotonically increases from 0 or 1 to 99. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get featureVersion(): int;
AST#method_declaration#Left static get AST#ERROR#Left featureVersion AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left int AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static get featureVersion(): int;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L270-L270
12d7950c4391f7ec178393d340e0f93bab371047
gitee
GAOMUgenius/SounderHarbor.git
ac0efa1a290980999e38aa868259d32c2f107bb2
features/tab/src/main/ets/components/PlayMusicComponent.ets
arkts
calculateRotationAngle
计算当前应该旋转的角度
private calculateRotationAngle(): number { // 确保duration不为0,避免除零错误 if (this.playingMusic.duration <= 0) { return 0; } // 根据播放进度计算角度 (time/duration) * 360° return (this.playingMusic.time / this.playingMusic.duration) * 360 * 3; }
AST#method_declaration#Left private calculateRotationAngle 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 { // 确保duration不为0,避免除零错误 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 . playingMusic AST#member_expression#Right AST#expression#Right . duration 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#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 根据播放进度计算角度 (time/duration) * 360° 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 AST#parenthesized_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 . playingMusic AST#member_expression#Right AST#expression#Right . time AST#member_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . playingMusic AST#member_expression#Right AST#expression#Right . duration AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 360 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 3 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
private calculateRotationAngle(): number { if (this.playingMusic.duration <= 0) { return 0; } return (this.playingMusic.time / this.playingMusic.duration) * 360 * 3; }
https://github.com/GAOMUgenius/SounderHarbor.git/blob/ac0efa1a290980999e38aa868259d32c2f107bb2/features/tab/src/main/ets/components/PlayMusicComponent.ets#L18-L26
5f267eaadecfd81fc319024898281044379108ed
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/products/phone/src/main/ets/viewmodel/IndexViewModel.ets
arkts
getIndexItemList
Data information on the home page. @returns IndexItem array.
getIndexItemList(): IndexItem[] { let IndexItemList: IndexItem[] = []; IndexItemList.push(new IndexItem($r('app.string.music_title'), $r('app.string.music_description'), $r('app.string.button_music'), $r('app.media.ic_music'), RouterUrlConstants.MUSIC_LIST)); IndexItemList.push(new IndexItem($r('app.string.live_title'), $r('app.string.live_description'), $r('app.string.button_live'), $r('app.media.ic_live'), RouterUrlConstants.LIVE)); return IndexItemList; }
AST#method_declaration#Left getIndexItemList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IndexItem [ ] AST#array_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 IndexItemList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left IndexItem [ ] 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#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 IndexItemList 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 IndexItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.music_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.music_description' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.button_music' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_music' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left RouterUrlConstants AST#expression#Right . MUSIC_LIST 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left IndexItemList 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 IndexItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.live_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.live_description' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.button_live' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_live' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left RouterUrlConstants AST#expression#Right . LIVE 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#statement#Left AST#return_statement#Left return AST#expression#Left IndexItemList AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getIndexItemList(): IndexItem[] { let IndexItemList: IndexItem[] = []; IndexItemList.push(new IndexItem($r('app.string.music_title'), $r('app.string.music_description'), $r('app.string.button_music'), $r('app.media.ic_music'), RouterUrlConstants.MUSIC_LIST)); IndexItemList.push(new IndexItem($r('app.string.live_title'), $r('app.string.live_description'), $r('app.string.button_live'), $r('app.media.ic_live'), RouterUrlConstants.LIVE)); return IndexItemList; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/products/phone/src/main/ets/viewmodel/IndexViewModel.ets#L28-L35
4bac65c2220ee8a96d5c8b60df61d964dfb2358b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/ContactsPage.ets
arkts
onPageShow
页面生命周期 - 页面显示时
onPageShow() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ContactsPage onPageShow - refreshing contacts'); this.loadContacts(); }
AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_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 'ContactsPage onPageShow - refreshing contacts' 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 . loadContacts 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
onPageShow() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ContactsPage onPageShow - refreshing contacts'); this.loadContacts(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/ContactsPage.ets#L47-L50
04345c0082527444aa3155f1c990a638cda51793
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/FileUtils.ets
arkts
getParentPath
通过URI或路径,获取对应文件父目录的路径名。 @param uriOrPath URI或路径
static getParentPath(uriOrPath: string): string { const parentUri = FileUtils.getParentUri(uriOrPath); return FileUtils.getFilePath(parentUri) }
AST#method_declaration#Left static getParentPath AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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 parentUri = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . getParentUri AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uriOrPath 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 FileUtils AST#expression#Right . getFilePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left parentUri 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 getParentPath(uriOrPath: string): string { const parentUri = FileUtils.getParentUri(uriOrPath); return FileUtils.getFilePath(parentUri) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L210-L213
95b97f0a1ac9e60b07671ffcfcf72637892f0b3b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CommonRepository.ets
arkts
getEntityPathInfo
获取实体信息与路径 @returns 实体信息与路径
async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.getEntityPathInfo(); }
AST#method_declaration#Left async getEntityPathInfo 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 NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Unknown 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . getEntityPathInfo 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
async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.getEntityPathInfo(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CommonRepository.ets#L35-L37
686dee8cb76db95f9e5664dedb9b84ea25f9588f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets
arkts
签名 @param data 需要签名的数据 @param privateKey 私钥 @returns 签名信息
export async function sign(data: string, privateKey: string): Promise<string> { try { let signer = cryptoFramework.createSign('RSA1024|PKCS1|SHA256'); // 创建非对称密钥生成器实例 let rsaKeyGenerator: cryptoFramework.AsyKeyGenerator = cryptoFramework.createAsyKeyGenerator('RSA1024'); // 将RSA密钥字符串转换为密钥类型 let priKeyBlob: cryptoFramework.DataBlob = { data: fromHexString(privateKey) }; let key: cryptoFramework.PriKey = (await rsaKeyGenerator.convertKey(null, priKeyBlob)).priKey; await signer.init(key); let signBlob = stringToUint8Array(data); let signedBlob = await signer.sign({ data: signBlob }); let tmpArr: Uint8Array = signedBlob.data; let rsaSignedBlobString = uint8ArrayToShowStr(tmpArr); return rsaSignedBlobString; } catch (error) { Logger.error(TAG, `RSA sign failed, ${error.code}, ${error.message}`); return ""; } }
AST#export_declaration#Left export AST#function_declaration#Left async function sign 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 privateKey : 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left signer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'RSA1024|PKCS1|SHA256' 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 rsaKeyGenerator : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . AsyKeyGenerator 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 cryptoFramework AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'RSA1024' 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 // 将RSA密钥字符串转换为密钥类型 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left priKeyBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob 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 data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left fromHexString AST#expression#Right AST#argument_list#Left ( AST#expression#Left privateKey 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left key : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = 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 rsaKeyGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . convertKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left priKeyBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . priKey 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#await_expression#Left await AST#expression#Left signer AST#expression#Right AST#await_expression#Right AST#expression#Right . init 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left signBlob = AST#expression#Left AST#call_expression#Left AST#expression#Left stringToUint8Array 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left signedBlob = 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 signer AST#expression#Right AST#await_expression#Right AST#expression#Right . sign 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 data AST#property_name#Right : AST#expression#Left signBlob 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 tmpArr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left signedBlob AST#expression#Right . data 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 rsaSignedBlobString = AST#expression#Left AST#call_expression#Left AST#expression#Left uint8ArrayToShowStr AST#expression#Right AST#argument_list#Left ( AST#expression#Left tmpArr 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 rsaSignedBlobString 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 Logger 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 ` RSA sign failed, 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 , 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#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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export async function sign(data: string, privateKey: string): Promise<string> { try { let signer = cryptoFramework.createSign('RSA1024|PKCS1|SHA256'); let rsaKeyGenerator: cryptoFramework.AsyKeyGenerator = cryptoFramework.createAsyKeyGenerator('RSA1024'); let priKeyBlob: cryptoFramework.DataBlob = { data: fromHexString(privateKey) }; let key: cryptoFramework.PriKey = (await rsaKeyGenerator.convertKey(null, priKeyBlob)).priKey; await signer.init(key); let signBlob = stringToUint8Array(data); let signedBlob = await signer.sign({ data: signBlob }); let tmpArr: Uint8Array = signedBlob.data; let rsaSignedBlobString = uint8ArrayToShowStr(tmpArr); return rsaSignedBlobString; } catch (error) { Logger.error(TAG, `RSA sign failed, ${error.code}, ${error.message}`); return ""; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets#L150-L168
6010815ef5c4440bb98084c702d64a3ba228a2a7
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/view/CorePage.ets
arkts
CoreContent
核心页面内容视图 @returns {void} 无返回值
@Builder private CoreContent() { MediumPaddingVerticalScroll() { ColumnBase({ widthValue: P100 }) { if (this.counterState.count > 0) { this.CounterCard(); SpaceVerticalLarge(); } IBestCellGroup({ inset: true, outerMargin: 0 }) { ForEach(this.vm.cards, (item: CoreCardItem, index: number) => { IBestCell({ title: item.title, label: item.description, isLink: true, leftContentWidth: P80, hasBorder: index !== this.vm.cards.length - 1, onCellClick: () => item.onClick() }); }, (_item: CoreCardItem, index: number) => `${index}`); }; }; }; }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CoreContent 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 MediumPaddingVerticalScroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnBase ( 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#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 . counterState AST#member_expression#Right AST#expression#Right . count 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 . CounterCard 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SpaceVerticalLarge ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#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 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 outerMargin : 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . cards 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 CoreCardItem 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#ui_custom_component_statement#Left IBestCell ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left label : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . description AST#member_expression#Right 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 leftContentWidth : AST#expression#Left P80 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hasBorder : 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 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 . vm AST#member_expression#Right AST#expression#Right . cards 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#component_parameter#Right , AST#component_parameter#Left onCellClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . onClick 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#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 CoreCardItem 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#template_literal#Left ` 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#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#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#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private CoreContent() { MediumPaddingVerticalScroll() { ColumnBase({ widthValue: P100 }) { if (this.counterState.count > 0) { this.CounterCard(); SpaceVerticalLarge(); } IBestCellGroup({ inset: true, outerMargin: 0 }) { ForEach(this.vm.cards, (item: CoreCardItem, index: number) => { IBestCell({ title: item.title, label: item.description, isLink: true, leftContentWidth: P80, hasBorder: index !== this.vm.cards.length - 1, onCellClick: () => item.onClick() }); }, (_item: CoreCardItem, index: number) => `${index}`); }; }; }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/CorePage.ets#L59-L82
a64250d8e241d0aea696601141b1245e42a086b4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/BaseArkWebClient.ets
arkts
ArkWeb事件分发
export interface BaseArkWebClient { /** * 设置webview.WebviewController给实现对象 */ setWebviewController(controller: webview.WebviewController): void; /** * 当Controller成功绑定到Web组件时触发该回调,且禁止在该事件回调前调用Web组件相关的接口,否则会抛出js-error异常。 * 推荐在此事件中注入JS对象registerJavaScriptProxy、设置自定义用户代理setCustomUserAgent,可以在回调中使用loadUrl,getWebId等操作网页不相关的接口。 * 但因该回调调用时网页还未加载,因此无法在回调中使用有关操作网页的接口,例如zoomIn、zoomOut等。 */ onControllerAttached?(): void; /** * 网页开始加载时触发该回调,且只在主frame触发,iframe或者frameset的内容加载时不会触发此回调。 */ onPageBegin?(event: OnPageBeginEvent): void; /** * 网页加载完成时触发该回调,且只在主frame触发。 */ onPageEnd?(event: OnPageEndEvent): void; /** * 网页加载进度变化时触发该回调。newProgress加载进度,取值范围为0到100的整数。 */ onProgressChange?(event: OnProgressChangeEvent): void; /** * Web回调事件。渲染流程中当HTTP响应的主体开始加载,新页面即将可见时触发该回调。此时文档加载还处于早期,因此链接的资源比如在线CSS、在线图片等可能尚不可用。 */ onPageVisible?(event: OnPageVisibleEvent): void; /** * 当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。 * 返回值boolean。返回true表示阻止此次加载,否则允许此次加载。 */ onLoadIntercept?(event: OnLoadInterceptEvent): boolean; /** * 当URL将要加载到当前Web中时,让宿主应用程序有机会获得控制权,回调函数返回true将导致当前Web中止加载URL,而返回false则会导致Web继续照常加载URL。 * onLoadIntercept接口和onOverrideUrlLoading接口行为不一致,触发时机也不同,所以在应用场景上存在一定区别。 * 主要是在LoadUrl和iframe(HTML标签,表示HTML内联框架元素,用于将另一个页面嵌入到当前页面中)加载时,onLoadIntercept事件会正常回调到, * 但onOverrideUrlLoading事件在LoadUrl加载时不会触发,在iframe加载HTTP(s)协议或about:blank时也不会触发。 * 详细介绍请见onLoadIntercept和onOverrideUrlLoading的说明。 */ onOverrideUrlLoading?(request: WebResourceRequest): boolean; /** * 当Web组件加载url之前触发该回调,用于拦截url并返回响应数据。 * 返回值WebResourceResponse。返回响应数据则按照响应数据加载,无响应数据则返回null表示按照原来的方式加载。 */ onInterceptRequest?(event: OnInterceptRequestEvent): WebResourceResponse | null; /** * 网页document标题更改时触发该回调,当H5未设置<title>元素时会返回对应的URL。 */ onTitleReceive?(event: OnTitleReceiveEvent): void; /** * 网页加载遇到错误时触发该回调。主资源与子资源出错都会回调该接口,可以通过request.isMainFrame来判断是否是主资源报错。 * 出于性能考虑,建议此回调中尽量执行简单逻辑。 * 在无网络的情况下,触发此回调。 */ onErrorReceive?(event: OnErrorReceiveEvent): void; /** * 网页加载资源遇到的HTTP错误(响应码>=400)时触发该回调。 */ onHttpErrorReceive?(event: OnHttpErrorReceiveEvent): void; /** * 通知用户加载资源时发生SSL错误,只支持主资源。(如果需要支持子资源,请使用OnSslErrorEvent接口) */ onSslErrorEventReceive?(event: OnSslErrorEventReceiveEvent): void; /** * 通知用户加载资源(主资源+子资源)时发生SSL错误,如果只想处理主资源的SSL错误,请用isMainFrame字段进行区分。 */ onSslErrorEvent?(event: SslErrorEvent): void; /** * 通知收到http auth认证请求。 * 当浏览器需要用户的凭据时触发。返回值boolean。返回false表示此次认证失败,否则成功。 */ onHttpAuthRequest?(event: OnHttpAuthRequestEvent): boolean; /** * 通知用户收到SSL客户端证书请求事件。当需要用户提供的SSL客户端证书时触发的回调。 */ onClientAuthenticationRequest?(event: OnClientAuthenticationEvent): void; /** * 应用渲染进程异常退出时触发该回调,可以在此回调中进行系统资源的释放、数据的保存等操作。如果应用希望异常恢复,需要调用loadUrl接口重新加载页面。 * 多个Web组件可能共享单个渲染进程,每个受影响的Web组件都会触发该回调。 */ onRenderExited?(event: OnRenderExitedEvent): void; /** * 通知主应用开始下载一个文件。 */ onDownloadStart?(event: OnDownloadStartEvent): void; /** * 调用此函数以处理具有“文件”输入类型的HTML表单。如果不调用此函数或返回false,Web组件会提供默认的“选择文件”处理界面。如果返回true,应用可以自定义“选择文件”的响应行为。 */ onShowFileSelector?(event: OnShowFileSelectorEvent): boolean; /** * 通知收到获取权限请求触发,需配置"ohos.permission.CAMERA"、"ohos.permission.MICROPHONE"权限。 */ onPermissionRequest?(event: OnPermissionRequestEvent): void; /** * 通知用户收到地理位置信息获取请求。请求显示地理位置权限时触发。 */ onGeolocationShow?(event: OnGeolocationShowEvent): void; /** * 通知用户先前被调用onGeolocationShow时收到地理位置信息获取请求已被取消。 * 地理位置信息获取请求已被取消的回调函数。 */ onGeolocationHide?(): void; /** * 通知开发者Web组件进入全屏模式。 */ onFullScreenEnter?(event: FullScreenEnterEvent): void /** * 通知开发者Web组件退出全屏模式。 */ onFullScreenExit?(): void /** * 长按特定元素(例如图片,链接)或鼠标右键,跳出菜单。 * 调用时触发的回调,以允许自定义显示上下文菜单。返回值boolean。自定义菜单返回true,触发的自定义菜单无效返回false。 */ onContextMenuShow?(event: OnContextMenuShowEvent): boolean; /** * 长按特定元素(例如图片,链接)或鼠标右键,隐藏菜单。 */ onContextMenuHide?(): void; /** * 当前页面显示比例的变化时触发该回调。 */ onScaleChange?(event: OnScaleChangeEvent): void; /** * 通知网页滚动条滚动位置。当滚动条滑动到指定位置时触发。 */ onScroll?(event: OnScrollEvent): void; /** * 该接口在网页过度滚动时触发,用于通知网页过度滚动的偏移量。 */ onOverScroll?(event: OnOverScrollEvent): void; /** * 当Web组件获得焦点时触发该回调。 */ onRequestSelected?(): void; /** * 通知收到屏幕捕获请求。 */ onScreenCaptureRequest?(event: OnScreenCaptureRequestEvent): void; /** * 使能multiWindowAccess情况下,通知用户新建窗口请求。 * 若不调用event.handler.setWebController接口,会造成render进程阻塞。 * 如果没有创建新窗口,调用event.handler.setWebController接口时设置成null,通知Web没有创建新窗口。 */ onWindowNew?(event: OnWindowNewEvent): void; /** * 通知用户窗口关闭请求。 */ onWindowExit?(): void; /** * 通知Web组件所加载的资源文件url信息。 */ onResourceLoad?(event: OnResourceLoadEvent): void; /** * 刷新或关闭场景下,在即将离开当前页面时触发此回调。刷新或关闭当前页面应先通过点击等方式获取焦点,才会触发此回调。 * 返回值boolean。当回调返回true时,应用可以调用自定义弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。当回调返回false时,函数中绘制的自定义弹窗无效。 */ onBeforeUnload?(event: OnBeforeUnloadEvent): boolean; /** * 加载网页页面完成时触发该回调,用于应用更新其访问的历史链接。 */ onRefreshAccessedHistory?(event: OnRefreshAccessedHistoryEvent): void; /** * 渲染进程无响应时触发该回调函数。 */ onRenderProcessNotResponding?(event: RenderProcessNotRespondingData): void; /** * 渲染进程由无响应状态变回正常运行状态时触发该回调函数,该回调表明该网页并非真正卡死。 */ onRenderProcessResponding?(): void; /** * 回调通知调用方网页页内查找的结果。 */ onSearchResultReceive?(event: OnSearchResultReceiveEvent): void; /** * 设置网页表单可以重新提交时触发的回调函数。 */ onDataResubmitted?(event: OnDataResubmittedEvent): void; /** * 设置键盘事件的回调函数,该回调在被Webview使用前触发。 * 触发的KeyEvent事件。返回值:回调函数通过返回boolean类型值来决定是否继续将该KeyEvent传入Webview内核。 */ onInterceptKeyEvent?(event: KeyEvent): boolean; /** * 设置接收到apple-touch-icon url地址时的回调函数。 */ onTouchIconUrlReceived?(event: OnTouchIconUrlReceivedEvent): void; /** * 设置应用为当前页面接收到新的favicon时的回调函数。 */ onFaviconReceived?(event: OnFaviconReceivedEvent): void; /** * 设置网页上的音频播放状态发生改变时的回调函数。 */ onAudioStateChanged?(event: OnAudioStateChangedEvent): void; /** * 设置网页首次内容绘制回调函数。 */ onFirstContentfulPaint?(event: OnFirstContentfulPaintEvent): void; /** * 设置网页绘制页面主要内容回调函数。 */ onFirstMeaningfulPaint?(paint: FirstMeaningfulPaint): void; /** * 设置网页绘制页面最大内容回调函数。 */ onLargestContentfulPaint?(paint: LargestContentfulPaint): void; /** * 当网页跳转提交时触发该回调。 */ onNavigationEntryCommitted?(details: LoadCommittedDetails): void; /** * 当同层标签生命周期变化时触发该回调。 */ onNativeEmbedLifecycleChange?(event: NativeEmbedDataInfo): void; /** * 当手指触摸到同层标签时触发该回调 */ onNativeEmbedGestureEvent?(event: NativeEmbedTouchInfo): void; /** * 网页中同层标签(如Embed标签或Object标签)在视口内的可见性发生变化时会触发该回调。 * 同层标签默认不可见,如果首次进入页面可见则会上报,不可见则不会上报,当同层标签大小由非0值变为0 *0时,不会上报不可见,由0 *0变为非0值时会上报可见。同层标签全部不可见才算不可见,部分可见或全部可见算作可见。 */ onNativeEmbedVisibilityChange?(info: NativeEmbedVisibilityInfo): void; /** * 收到网站安全风险检查结果时触发的回调。 */ onSafeBrowsingCheckResult?(threatType: ThreatType): void; /** * 智能防跟踪功能使能时,当追踪者cookie被拦截时触发该回调。 * @param details */ onIntelligentTrackingPreventionResult?(details: IntelligentTrackingPreventionDetails): void; /** * 网页meta中viewport-fit配置项更改时触发该回调,应用可在此回调中自适应布局视口。 */ onViewportFitChanged?(viewportFit: ViewportFit): void; /** * 网页中可编辑元素(如input标签)拉起软键盘之前会回调该接口。 * 应用可以使用该接口拦截系统软键盘的弹出,配置应用定制的软键盘(应用根据该接口可以决定使用系统默认软键盘/定制enter键的系统软键盘/全部由应用自定义的软键盘)。 */ onInterceptKeyboardAttach?(keyboardCallbackInfo: WebKeyboardCallbackInfo): WebKeyboardOptions; /** * 一个页面发生广告过滤后,通过此回调接口通知过滤的详细信息。由于页面可能随时发生变化并不断产生网络请求,为了减少通知频次、降低对页面加载过程的影响,仅在页面加载完成时进行首次通知,此后发生的过滤将间隔1秒钟上报,无广告过滤则无通知。 */ onAdsBlocked?(details: AdsBlockedDetails): void; /** * 网页触发alert()告警弹窗时触发回调。 * 返回值boolean。当回调返回true时,应用可以调用自定义弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。当回调返回false时,函数中绘制的自定义弹窗无效。 */ onAlert?(event: OnAlertEvent): boolean; /** * 网页调用confirm()告警时触发此回调。 * 返回值boolean。当回调返回true时,应用可以调用自定义弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。当回调返回false时,函数中绘制的自定义弹窗无效。 */ onConfirm?(event: OnConfirmEvent): boolean; /** * 网页调用prompt()告警时触发此回调。 * 返回值boolean。当回调返回true时,应用可以调用自定义弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。当回调返回false时,函数中绘制的自定义弹窗无效。 */ onPrompt?(event: OnPromptEvent): boolean; /** * 通知宿主应用JavaScript console消息。 * 返回值boolean。当返回true时,该条消息将不会再打印至控制台,反之仍会打印至控制台。 */ onConsole?(event: OnConsoleEvent): boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface BaseArkWebClient AST#object_type#Left { /** * 设置webview.WebviewController给实现对象 */ AST#type_member#Left setWebviewController AST#parameter_list#Left ( AST#parameter#Left controller : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_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#type_member#Right ; /** * 当Controller成功绑定到Web组件时触发该回调,且禁止在该事件回调前调用Web组件相关的接口,否则会抛出js-error异常。 * 推荐在此事件中注入JS对象registerJavaScriptProxy、设置自定义用户代理setCustomUserAgent,可以在回调中使用loadUrl,getWebId等操作网页不相关的接口。 * 但因该回调调用时网页还未加载,因此无法在回调中使用有关操作网页的接口,例如zoomIn、zoomOut等。 */ AST#type_member#Left onControllerAttached AST#ERROR#Left ? AST#ERROR#Right 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#type_member#Right ; /** * 网页开始加载时触发该回调,且只在主frame触发,iframe或者frameset的内容加载时不会触发此回调。 */ AST#type_member#Left onPageBegin AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnPageBeginEvent 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#type_member#Right ; /** * 网页加载完成时触发该回调,且只在主frame触发。 */ AST#type_member#Left onPageEnd AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnPageEndEvent 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#type_member#Right ; /** * 网页加载进度变化时触发该回调。newProgress加载进度,取值范围为0到100的整数。 */ AST#type_member#Left onProgressChange AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnProgressChangeEvent 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#type_member#Right ; /** * Web回调事件。渲染流程中当HTTP响应的主体开始加载,新页面即将可见时触发该回调。此时文档加载还处于早期,因此链接的资源比如在线CSS、在线图片等可能尚不可用。 */ AST#type_member#Left onPageVisible AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnPageVisibleEvent 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#type_member#Right ; /** * 当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。 * 返回值boolean。返回true表示阻止此次加载,否则允许此次加载。 */ AST#type_member#Left onLoadIntercept AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnLoadInterceptEvent 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#type_member#Right ; /** * 当URL将要加载到当前Web中时,让宿主应用程序有机会获得控制权,回调函数返回true将导致当前Web中止加载URL,而返回false则会导致Web继续照常加载URL。 * onLoadIntercept接口和onOverrideUrlLoading接口行为不一致,触发时机也不同,所以在应用场景上存在一定区别。 * 主要是在LoadUrl和iframe(HTML标签,表示HTML内联框架元素,用于将另一个页面嵌入到当前页面中)加载时,onLoadIntercept事件会正常回调到, * 但onOverrideUrlLoading事件在LoadUrl加载时不会触发,在iframe加载HTTP(s)协议或about:blank时也不会触发。 * 详细介绍请见onLoadIntercept和onOverrideUrlLoading的说明。 */ AST#type_member#Left onOverrideUrlLoading AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left WebResourceRequest 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#type_member#Right ; /** * 当Web组件加载url之前触发该回调,用于拦截url并返回响应数据。 * 返回值WebResourceResponse。返回响应数据则按照响应数据加载,无响应数据则返回null表示按照原来的方式加载。 */ AST#type_member#Left onInterceptRequest AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnInterceptRequestEvent 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 WebResourceResponse AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 网页document标题更改时触发该回调,当H5未设置<title>元素时会返回对应的URL。 */ AST#type_member#Left onTitleReceive AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnTitleReceiveEvent 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#type_member#Right ; /** * 网页加载遇到错误时触发该回调。主资源与子资源出错都会回调该接口,可以通过request.isMainFrame来判断是否是主资源报错。 * 出于性能考虑,建议此回调中尽量执行简单逻辑。 * 在无网络的情况下,触发此回调。 */ AST#type_member#Left onErrorReceive AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnErrorReceiveEvent 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#type_member#Right ; /** * 网页加载资源遇到的HTTP错误(响应码>=400)时触发该回调。 */ AST#type_member#Left onHttpErrorReceive AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnHttpErrorReceiveEvent 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#type_member#Right ; /** * 通知用户加载资源时发生SSL错误,只支持主资源。(如果需要支持子资源,请使用OnSslErrorEvent接口) */ AST#type_member#Left onSslErrorEventReceive AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnSslErrorEventReceiveEvent 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#type_member#Right ; /** * 通知用户加载资源(主资源+子资源)时发生SSL错误,如果只想处理主资源的SSL错误,请用isMainFrame字段进行区分。 */ AST#type_member#Left onSslErrorEvent AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left SslErrorEvent 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#type_member#Right ; /** * 通知收到http auth认证请求。 * 当浏览器需要用户的凭据时触发。返回值boolean。返回false表示此次认证失败,否则成功。 */ AST#type_member#Left onHttpAuthRequest AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnHttpAuthRequestEvent 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#type_member#Right ; /** * 通知用户收到SSL客户端证书请求事件。当需要用户提供的SSL客户端证书时触发的回调。 */ AST#type_member#Left onClientAuthenticationRequest AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnClientAuthenticationEvent 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#type_member#Right ; /** * 应用渲染进程异常退出时触发该回调,可以在此回调中进行系统资源的释放、数据的保存等操作。如果应用希望异常恢复,需要调用loadUrl接口重新加载页面。 * 多个Web组件可能共享单个渲染进程,每个受影响的Web组件都会触发该回调。 */ AST#type_member#Left onRenderExited AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnRenderExitedEvent 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#type_member#Right ; /** * 通知主应用开始下载一个文件。 */ AST#type_member#Left onDownloadStart AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnDownloadStartEvent 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#type_member#Right ; /** * 调用此函数以处理具有“文件”输入类型的HTML表单。如果不调用此函数或返回false,Web组件会提供默认的“选择文件”处理界面。如果返回true,应用可以自定义“选择文件”的响应行为。 */ AST#type_member#Left onShowFileSelector AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnShowFileSelectorEvent 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#type_member#Right ; /** * 通知收到获取权限请求触发,需配置"ohos.permission.CAMERA"、"ohos.permission.MICROPHONE"权限。 */ AST#type_member#Left onPermissionRequest AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnPermissionRequestEvent 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#type_member#Right ; /** * 通知用户收到地理位置信息获取请求。请求显示地理位置权限时触发。 */ AST#type_member#Left onGeolocationShow AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnGeolocationShowEvent 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#type_member#Right ; /** * 通知用户先前被调用onGeolocationShow时收到地理位置信息获取请求已被取消。 * 地理位置信息获取请求已被取消的回调函数。 */ AST#type_member#Left onGeolocationHide AST#ERROR#Left ? AST#ERROR#Right 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#type_member#Right ; /** * 通知开发者Web组件进入全屏模式。 */ AST#type_member#Left onFullScreenEnter AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left FullScreenEnterEvent 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#type_member#Right /** * 通知开发者Web组件退出全屏模式。 */ AST#type_member#Left onFullScreenExit AST#ERROR#Left ? AST#ERROR#Right 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#type_member#Right /** * 长按特定元素(例如图片,链接)或鼠标右键,跳出菜单。 * 调用时触发的回调,以允许自定义显示上下文菜单。返回值boolean。自定义菜单返回true,触发的自定义菜单无效返回false。 */ AST#type_member#Left onContextMenuShow AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnContextMenuShowEvent 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#type_member#Right ; /** * 长按特定元素(例如图片,链接)或鼠标右键,隐藏菜单。 */ AST#type_member#Left onContextMenuHide AST#ERROR#Left ? AST#ERROR#Right 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#type_member#Right ; /** * 当前页面显示比例的变化时触发该回调。 */ AST#type_member#Left onScaleChange AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnScaleChangeEvent 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#type_member#Right ; /** * 通知网页滚动条滚动位置。当滚动条滑动到指定位置时触发。 */ AST#type_member#Left onScroll AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnScrollEvent 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#type_member#Right ; /** * 该接口在网页过度滚动时触发,用于通知网页过度滚动的偏移量。 */ AST#type_member#Left onOverScroll AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnOverScrollEvent 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#type_member#Right ; /** * 当Web组件获得焦点时触发该回调。 */ AST#type_member#Left onRequestSelected AST#ERROR#Left ? AST#ERROR#Right 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#type_member#Right ; /** * 通知收到屏幕捕获请求。 */ AST#type_member#Left onScreenCaptureRequest AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnScreenCaptureRequestEvent 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#type_member#Right ; /** * 使能multiWindowAccess情况下,通知用户新建窗口请求。 * 若不调用event.handler.setWebController接口,会造成render进程阻塞。 * 如果没有创建新窗口,调用event.handler.setWebController接口时设置成null,通知Web没有创建新窗口。 */ AST#type_member#Left onWindowNew AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnWindowNewEvent 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#type_member#Right ; /** * 通知用户窗口关闭请求。 */ AST#type_member#Left onWindowExit AST#ERROR#Left ? AST#ERROR#Right 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#type_member#Right ; /** * 通知Web组件所加载的资源文件url信息。 */ AST#type_member#Left onResourceLoad AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnResourceLoadEvent 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#type_member#Right ; /** * 刷新或关闭场景下,在即将离开当前页面时触发此回调。刷新或关闭当前页面应先通过点击等方式获取焦点,才会触发此回调。 * 返回值boolean。当回调返回true时,应用可以调用自定义弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。当回调返回false时,函数中绘制的自定义弹窗无效。 */ AST#type_member#Left onBeforeUnload AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnBeforeUnloadEvent 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#type_member#Right ; /** * 加载网页页面完成时触发该回调,用于应用更新其访问的历史链接。 */ AST#type_member#Left onRefreshAccessedHistory AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnRefreshAccessedHistoryEvent 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#type_member#Right ; /** * 渲染进程无响应时触发该回调函数。 */ AST#type_member#Left onRenderProcessNotResponding AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left RenderProcessNotRespondingData 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#type_member#Right ; /** * 渲染进程由无响应状态变回正常运行状态时触发该回调函数,该回调表明该网页并非真正卡死。 */ AST#type_member#Left onRenderProcessResponding AST#ERROR#Left ? AST#ERROR#Right 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#type_member#Right ; /** * 回调通知调用方网页页内查找的结果。 */ AST#type_member#Left onSearchResultReceive AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnSearchResultReceiveEvent 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#type_member#Right ; /** * 设置网页表单可以重新提交时触发的回调函数。 */ AST#type_member#Left onDataResubmitted AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnDataResubmittedEvent 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#type_member#Right ; /** * 设置键盘事件的回调函数,该回调在被Webview使用前触发。 * 触发的KeyEvent事件。返回值:回调函数通过返回boolean类型值来决定是否继续将该KeyEvent传入Webview内核。 */ AST#type_member#Left onInterceptKeyEvent AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left KeyEvent 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#type_member#Right ; /** * 设置接收到apple-touch-icon url地址时的回调函数。 */ AST#type_member#Left onTouchIconUrlReceived AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnTouchIconUrlReceivedEvent 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#type_member#Right ; /** * 设置应用为当前页面接收到新的favicon时的回调函数。 */ AST#type_member#Left onFaviconReceived AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnFaviconReceivedEvent 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#type_member#Right ; /** * 设置网页上的音频播放状态发生改变时的回调函数。 */ AST#type_member#Left onAudioStateChanged AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnAudioStateChangedEvent 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#type_member#Right ; /** * 设置网页首次内容绘制回调函数。 */ AST#type_member#Left onFirstContentfulPaint AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnFirstContentfulPaintEvent 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#type_member#Right ; /** * 设置网页绘制页面主要内容回调函数。 */ AST#type_member#Left onFirstMeaningfulPaint AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left paint : AST#type_annotation#Left AST#primary_type#Left FirstMeaningfulPaint 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#type_member#Right ; /** * 设置网页绘制页面最大内容回调函数。 */ AST#type_member#Left onLargestContentfulPaint AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left paint : AST#type_annotation#Left AST#primary_type#Left LargestContentfulPaint 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#type_member#Right ; /** * 当网页跳转提交时触发该回调。 */ AST#type_member#Left onNavigationEntryCommitted AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left details : AST#type_annotation#Left AST#primary_type#Left LoadCommittedDetails 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#type_member#Right ; /** * 当同层标签生命周期变化时触发该回调。 */ AST#type_member#Left onNativeEmbedLifecycleChange AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left NativeEmbedDataInfo 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#type_member#Right ; /** * 当手指触摸到同层标签时触发该回调 */ AST#type_member#Left onNativeEmbedGestureEvent AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left NativeEmbedTouchInfo 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#type_member#Right ; /** * 网页中同层标签(如Embed标签或Object标签)在视口内的可见性发生变化时会触发该回调。 * 同层标签默认不可见,如果首次进入页面可见则会上报,不可见则不会上报,当同层标签大小由非0值变为0 *0时,不会上报不可见,由0 *0变为非0值时会上报可见。同层标签全部不可见才算不可见,部分可见或全部可见算作可见。 */ AST#type_member#Left onNativeEmbedVisibilityChange AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left NativeEmbedVisibilityInfo 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#type_member#Right ; /** * 收到网站安全风险检查结果时触发的回调。 */ AST#type_member#Left onSafeBrowsingCheckResult AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left threatType : AST#type_annotation#Left AST#primary_type#Left ThreatType 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#type_member#Right ; /** * 智能防跟踪功能使能时,当追踪者cookie被拦截时触发该回调。 * @param details */ AST#type_member#Left onIntelligentTrackingPreventionResult AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left details : AST#type_annotation#Left AST#primary_type#Left IntelligentTrackingPreventionDetails 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#type_member#Right ; /** * 网页meta中viewport-fit配置项更改时触发该回调,应用可在此回调中自适应布局视口。 */ AST#type_member#Left onViewportFitChanged AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left viewportFit : AST#type_annotation#Left AST#primary_type#Left ViewportFit 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#type_member#Right ; /** * 网页中可编辑元素(如input标签)拉起软键盘之前会回调该接口。 * 应用可以使用该接口拦截系统软键盘的弹出,配置应用定制的软键盘(应用根据该接口可以决定使用系统默认软键盘/定制enter键的系统软键盘/全部由应用自定义的软键盘)。 */ AST#type_member#Left onInterceptKeyboardAttach AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left keyboardCallbackInfo : AST#type_annotation#Left AST#primary_type#Left WebKeyboardCallbackInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WebKeyboardOptions AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 一个页面发生广告过滤后,通过此回调接口通知过滤的详细信息。由于页面可能随时发生变化并不断产生网络请求,为了减少通知频次、降低对页面加载过程的影响,仅在页面加载完成时进行首次通知,此后发生的过滤将间隔1秒钟上报,无广告过滤则无通知。 */ AST#type_member#Left onAdsBlocked AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left details : AST#type_annotation#Left AST#primary_type#Left AdsBlockedDetails 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#type_member#Right ; /** * 网页触发alert()告警弹窗时触发回调。 * 返回值boolean。当回调返回true时,应用可以调用自定义弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。当回调返回false时,函数中绘制的自定义弹窗无效。 */ AST#type_member#Left onAlert AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnAlertEvent 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#type_member#Right ; /** * 网页调用confirm()告警时触发此回调。 * 返回值boolean。当回调返回true时,应用可以调用自定义弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。当回调返回false时,函数中绘制的自定义弹窗无效。 */ AST#type_member#Left onConfirm AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnConfirmEvent 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#type_member#Right ; /** * 网页调用prompt()告警时触发此回调。 * 返回值boolean。当回调返回true时,应用可以调用自定义弹窗能力(包括确认和取消),并且需要根据用户的确认或取消操作调用JsResult通知Web组件最终是否离开当前页面。当回调返回false时,函数中绘制的自定义弹窗无效。 */ AST#type_member#Left onPrompt AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnPromptEvent 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#type_member#Right ; /** * 通知宿主应用JavaScript console消息。 * 返回值boolean。当返回true时,该条消息将不会再打印至控制台,反之仍会打印至控制台。 */ AST#type_member#Left onConsole AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnConsoleEvent 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#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface BaseArkWebClient { setWebviewController(controller: webview.WebviewController): void; onControllerAttached?(): void; onPageBegin?(event: OnPageBeginEvent): void; onPageEnd?(event: OnPageEndEvent): void; onProgressChange?(event: OnProgressChangeEvent): void; onPageVisible?(event: OnPageVisibleEvent): void; onLoadIntercept?(event: OnLoadInterceptEvent): boolean; onOverrideUrlLoading?(request: WebResourceRequest): boolean; onInterceptRequest?(event: OnInterceptRequestEvent): WebResourceResponse | null; onTitleReceive?(event: OnTitleReceiveEvent): void; onErrorReceive?(event: OnErrorReceiveEvent): void; onHttpErrorReceive?(event: OnHttpErrorReceiveEvent): void; onSslErrorEventReceive?(event: OnSslErrorEventReceiveEvent): void; onSslErrorEvent?(event: SslErrorEvent): void; onHttpAuthRequest?(event: OnHttpAuthRequestEvent): boolean; onClientAuthenticationRequest?(event: OnClientAuthenticationEvent): void; onRenderExited?(event: OnRenderExitedEvent): void; onDownloadStart?(event: OnDownloadStartEvent): void; onShowFileSelector?(event: OnShowFileSelectorEvent): boolean; onPermissionRequest?(event: OnPermissionRequestEvent): void; onGeolocationShow?(event: OnGeolocationShowEvent): void; onGeolocationHide?(): void; onFullScreenEnter?(event: FullScreenEnterEvent): void onFullScreenExit?(): void onContextMenuShow?(event: OnContextMenuShowEvent): boolean; onContextMenuHide?(): void; onScaleChange?(event: OnScaleChangeEvent): void; onScroll?(event: OnScrollEvent): void; onOverScroll?(event: OnOverScrollEvent): void; onRequestSelected?(): void; onScreenCaptureRequest?(event: OnScreenCaptureRequestEvent): void; onWindowNew?(event: OnWindowNewEvent): void; onWindowExit?(): void; onResourceLoad?(event: OnResourceLoadEvent): void; onBeforeUnload?(event: OnBeforeUnloadEvent): boolean; onRefreshAccessedHistory?(event: OnRefreshAccessedHistoryEvent): void; onRenderProcessNotResponding?(event: RenderProcessNotRespondingData): void; onRenderProcessResponding?(): void; onSearchResultReceive?(event: OnSearchResultReceiveEvent): void; onDataResubmitted?(event: OnDataResubmittedEvent): void; onInterceptKeyEvent?(event: KeyEvent): boolean; onTouchIconUrlReceived?(event: OnTouchIconUrlReceivedEvent): void; onFaviconReceived?(event: OnFaviconReceivedEvent): void; onAudioStateChanged?(event: OnAudioStateChangedEvent): void; onFirstContentfulPaint?(event: OnFirstContentfulPaintEvent): void; onFirstMeaningfulPaint?(paint: FirstMeaningfulPaint): void; onLargestContentfulPaint?(paint: LargestContentfulPaint): void; onNavigationEntryCommitted?(details: LoadCommittedDetails): void; onNativeEmbedLifecycleChange?(event: NativeEmbedDataInfo): void; onNativeEmbedGestureEvent?(event: NativeEmbedTouchInfo): void; onNativeEmbedVisibilityChange?(info: NativeEmbedVisibilityInfo): void; onSafeBrowsingCheckResult?(threatType: ThreatType): void; onIntelligentTrackingPreventionResult?(details: IntelligentTrackingPreventionDetails): void; onViewportFitChanged?(viewportFit: ViewportFit): void; onInterceptKeyboardAttach?(keyboardCallbackInfo: WebKeyboardCallbackInfo): WebKeyboardOptions; onAdsBlocked?(details: AdsBlockedDetails): void; onAlert?(event: OnAlertEvent): boolean; onConfirm?(event: OnConfirmEvent): boolean; onPrompt?(event: OnPromptEvent): boolean; onConsole?(event: OnConsoleEvent): boolean; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/BaseArkWebClient.ets#L6-L335
93077467769ca270f3644b04c9131209a5e457c9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/StorageManager.ets
arkts
setSecureItem
安全存储敏感数据 @param key 键 @param value 值 @returns 操作结果
static async setSecureItem<T>(key: string, value: T): Promise<StorageResult<void>> { return this.setItem(key, value, { name: AppConstants.SECURE_STORAGE_NAME, encrypted: true }); }
AST#method_declaration#Left static async setSecureItem AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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 value : AST#type_annotation#Left AST#primary_type#Left T 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 StorageResult 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#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 this AST#expression#Right . setItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#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 AppConstants AST#expression#Right . SECURE_STORAGE_NAME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left encrypted 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async setSecureItem<T>(key: string, value: T): Promise<StorageResult<void>> { return this.setItem(key, value, { name: AppConstants.SECURE_STORAGE_NAME, encrypted: true }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L263-L265
d9808780ecf2044394a022eb070f878408e90e76
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/plan/vipplan.ets
arkts
****************************build****************************
build() { Column() { this.allBodyPlan() this.title() // 内容区域 Column({ space: 24 }) { this.planOption() Button('立即解锁') .width('100%') .height(52) .backgroundColor('#6C5CE7') .fontColor('#FFFFFF') .fontSize(18) .fontWeight(FontWeight.Medium) .borderRadius(26) .margin({ top: 20 }) .onClick(() => { router.pushUrl({url:"pages/plan/vip",params:{userId:this.userId,token:this.token}}) }) } .padding({ left: 24, right: 24, top: 32 }) .layoutWeight(1) } .width('100%') .height('100%') .backgroundColor('#FFFFFF') }
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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allBodyPlan 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title 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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . planOption 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#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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 52 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#6C5CE7' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 26 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 20 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl 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/plan/vip" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left userId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left token AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . token 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#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#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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 32 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#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 . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' 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#build_body#Right AST#build_method#Right
build() { Column() { this.allBodyPlan() this.title() Column({ space: 24 }) { this.planOption() Button('立即解锁') .width('100%') .height(52) .backgroundColor('#6C5CE7') .fontColor('#FFFFFF') .fontSize(18) .fontWeight(FontWeight.Medium) .borderRadius(26) .margin({ top: 20 }) .onClick(() => { router.pushUrl({url:"pages/plan/vip",params:{userId:this.userId,token:this.token}}) }) } .padding({ left: 24, right: 24, top: 32 }) .layoutWeight(1) } .width('100%') .height('100%') .backgroundColor('#FFFFFF') }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/vipplan.ets#L184-L213
e449b6c5383ae09b5271e5aca0eb14b427e51dd3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets
arkts
addCriticalAssetAuth
[End add_critical_asset]
async function addCriticalAssetAuth(): Promise<string> { let result: string = ''; let attr: asset.AssetMap = new Map(); attr.set(asset.Tag.SECRET, stringToArray('demo_pwd')); attr.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); attr.set(asset.Tag.ACCESSIBILITY, asset.Accessibility.DEVICE_FIRST_UNLOCKED); attr.set(asset.Tag.DATA_LABEL_NORMAL_1, stringToArray('demo_label')); attr.set(asset.Tag.AUTH_TYPE, asset.AuthType.ANY); try { await asset.add(attr).then(() => { console.info(`Asset added successfully.`); result = 'Add Critical Asset Auth Success'; }).catch((err: BusinessError) => { console.error(`Failed to add Asset. Code is ${err.code}, message is ${err.message}`); result = 'Add Critical Asset Auth Failed'; }) } catch (error) { let err = error as BusinessError; console.error(`Failed to add Asset. Code is ${err.code}, message is ${err.message}`); result = 'Add Critical Asset Auth Failed'; } return result; }
AST#function_declaration#Left async function addCriticalAssetAuth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > 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 result : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' 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 attr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left asset . AssetMap AST#qualified_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 Map 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 attr AST#expression#Right . set 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 asset AST#expression#Right . Tag AST#member_expression#Right AST#expression#Right . SECRET AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left stringToArray AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'demo_pwd' 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 AST#member_expression#Left AST#expression#Left attr AST#expression#Right . set 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 asset AST#expression#Right . Tag AST#member_expression#Right AST#expression#Right . ALIAS AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left stringToArray AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'demo_alias2' 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 AST#member_expression#Left AST#expression#Left attr AST#expression#Right . set 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 asset AST#expression#Right . Tag AST#member_expression#Right AST#expression#Right . ACCESSIBILITY AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left asset AST#expression#Right . Accessibility AST#member_expression#Right AST#expression#Right . DEVICE_FIRST_UNLOCKED 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 attr AST#expression#Right . set 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 asset AST#expression#Right . Tag AST#member_expression#Right AST#expression#Right . DATA_LABEL_NORMAL_1 AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left stringToArray AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'demo_label' 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 AST#member_expression#Left AST#expression#Left attr AST#expression#Right . set 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 asset AST#expression#Right . Tag AST#member_expression#Right AST#expression#Right . AUTH_TYPE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left asset AST#expression#Right . AuthType AST#member_expression#Right AST#expression#Right . ANY 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#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#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#await_expression#Left await AST#expression#Left asset AST#expression#Right AST#await_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left attr 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_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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Asset added successfully. ` 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 result = AST#expression#Left 'Add Critical Asset Auth Success' 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 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 AST#template_literal#Left ` Failed to add Asset. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left 'Add Critical Asset Auth Failed' 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#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 err = 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#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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to add Asset. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is 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#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left 'Add Critical Asset Auth Failed' 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#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
async function addCriticalAssetAuth(): Promise<string> { let result: string = ''; let attr: asset.AssetMap = new Map(); attr.set(asset.Tag.SECRET, stringToArray('demo_pwd')); attr.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); attr.set(asset.Tag.ACCESSIBILITY, asset.Accessibility.DEVICE_FIRST_UNLOCKED); attr.set(asset.Tag.DATA_LABEL_NORMAL_1, stringToArray('demo_label')); attr.set(asset.Tag.AUTH_TYPE, asset.AuthType.ANY); try { await asset.add(attr).then(() => { console.info(`Asset added successfully.`); result = 'Add Critical Asset Auth Success'; }).catch((err: BusinessError) => { console.error(`Failed to add Asset. Code is ${err.code}, message is ${err.message}`); result = 'Add Critical Asset Auth Failed'; }) } catch (error) { let err = error as BusinessError; console.error(`Failed to add Asset. Code is ${err.code}, message is ${err.message}`); result = 'Add Critical Asset Auth Failed'; } return result; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets#L158-L180
7fcee6c6a30c4a0c3fa6aff62a8e13fcab140d7b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets
arkts
setXLocationType
Get x locationType. @param offsetX
public setXLocationType(offsetX: number) { if (offsetX > this.offsetXRight - CommonConstant.OFFSET_RANGE && offsetX < this.offsetXRight + CommonConstant.OFFSET_RANGE) { this.xLocationType = XLocationEnum.XRight; } else if (offsetX > this.offsetXLeft - CommonConstant.OFFSET_RANGE && offsetX < this.offsetXLeft + CommonConstant.OFFSET_RANGE) { this.xLocationType = XLocationEnum.XLeft; } else { this.xLocationType = XLocationEnum.noChange; } }
AST#method_declaration#Left public setXLocationType AST#parameter_list#Left ( AST#parameter#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left 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#binary_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 AST#binary_expression#Left AST#expression#Left offsetX AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetXRight AST#member_expression#Right AST#expression#Right - AST#expression#Left CommonConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . OFFSET_RANGE AST#member_expression#Right AST#expression#Right && AST#expression#Left offsetX AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetXRight AST#member_expression#Right AST#expression#Right + AST#expression#Left CommonConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . OFFSET_RANGE 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 this AST#expression#Right . xLocationType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left XLocationEnum AST#expression#Right . XRight AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else 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#binary_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 AST#binary_expression#Left AST#expression#Left offsetX AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetXLeft AST#member_expression#Right AST#expression#Right - AST#expression#Left CommonConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . OFFSET_RANGE AST#member_expression#Right AST#expression#Right && AST#expression#Left offsetX AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetXLeft AST#member_expression#Right AST#expression#Right + AST#expression#Left CommonConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . OFFSET_RANGE 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 this AST#expression#Right . xLocationType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left XLocationEnum AST#expression#Right . XLeft AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . xLocationType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left XLocationEnum AST#expression#Right . noChange 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_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setXLocationType(offsetX: number) { if (offsetX > this.offsetXRight - CommonConstant.OFFSET_RANGE && offsetX < this.offsetXRight + CommonConstant.OFFSET_RANGE) { this.xLocationType = XLocationEnum.XRight; } else if (offsetX > this.offsetXLeft - CommonConstant.OFFSET_RANGE && offsetX < this.offsetXLeft + CommonConstant.OFFSET_RANGE) { this.xLocationType = XLocationEnum.XLeft; } else { this.xLocationType = XLocationEnum.noChange; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets#L78-L88
25094ee8b63d33a430eca9623ccb0582956c541b
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets
arkts
getVerifyMap
获取验证项目映射。 @return {Map<number, VerifyItem>} verifyMap.
getVerifyMap(): Map<number, VerifyItem> { let verifyMap: Map<number, VerifyItem> = new Map(); verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK')); verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR')); return verifyMap; }
AST#method_declaration#Left getVerifyMap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left VerifyItem 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 verifyMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left VerifyItem 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 Map 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 verifyMap AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left VerifyItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_verity_character1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'XYZK' 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 AST#member_expression#Left AST#expression#Left verifyMap AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left VerifyItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_verity_character2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'LHBR' 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#return_statement#Left return AST#expression#Left verifyMap AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getVerifyMap(): Map<number, VerifyItem> { let verifyMap: Map<number, VerifyItem> = new Map(); verifyMap.set(0, new VerifyItem($r('app.media.ic_verity_character1'), 'XYZK')); verifyMap.set(1, new VerifyItem($r('app.media.ic_verity_character2'), 'LHBR')); return verifyMap; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets#L15-L20
b42b21857a4fb3046be421aab1dd3adffc67f210
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
extractKeyTopics
从用户消息中提取关键话题
private extractKeyTopics(messages: string[]): string[] { const topics: string[] = []; const keywords = ['提醒', '记录', '任务', '笔记', '备忘', '会议', '工作', '学习', '生活', '计划']; for (const msg of messages) { for (const keyword of keywords) { if (msg.includes(keyword) && !topics.includes(keyword)) { topics.push(keyword); if (topics.length >= 5) break; } } if (topics.length >= 5) break; } return topics; }
AST#method_declaration#Left private extractKeyTopics AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] 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 topics : 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#array_literal#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 keywords = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '提醒' AST#expression#Right , AST#expression#Left '记录' AST#expression#Right , AST#expression#Left '任务' AST#expression#Right , AST#expression#Left '笔记' AST#expression#Right , AST#expression#Left '备忘' AST#expression#Right , AST#expression#Left '会议' AST#expression#Right , AST#expression#Left '工作' AST#expression#Right , AST#expression#Left '学习' AST#expression#Right , AST#expression#Left '生活' 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#for_statement#Left for ( const msg of AST#expression#Left messages AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const keyword of AST#expression#Left keywords AST#expression#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left msg AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left topics AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left topics AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left topics AST#expression#Right . length AST#member_expression#Right AST#expression#Right >= AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#if_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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left topics AST#expression#Right . length AST#member_expression#Right AST#expression#Right >= AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left topics AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private extractKeyTopics(messages: string[]): string[] { const topics: string[] = []; const keywords = ['提醒', '记录', '任务', '笔记', '备忘', '会议', '工作', '学习', '生活', '计划']; for (const msg of messages) { for (const keyword of keywords) { if (msg.includes(keyword) && !topics.includes(keyword)) { topics.push(keyword); if (topics.length >= 5) break; } } if (topics.length >= 5) break; } return topics; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L417-L432
38ece485036ec21e82bcb61342585338391a525b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
getPurchaseTitle
获取提交订单的标题 @returns {string} 标题文案
private getPurchaseTitle(): string { try { const titleRes: Resource = $r("app.string.purchase_goods"); return ContextUtil.getUIAbilityCtx().resourceManager.getStringSync(titleRes.id); } catch (error) { return ""; } }
AST#method_declaration#Left private getPurchaseTitle 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left titleRes : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.purchase_goods" AST#expression#Right ) AST#resource_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 AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ContextUtil AST#expression#Right . getUIAbilityCtx AST#member_expression#Right 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 . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left titleRes AST#expression#Right . id 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#catch_clause#Left catch ( error ) AST#block_statement#Left { 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getPurchaseTitle(): string { try { const titleRes: Resource = $r("app.string.purchase_goods"); return ContextUtil.getUIAbilityCtx().resourceManager.getStringSync(titleRes.id); } catch (error) { return ""; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L339-L346
e77b727a4dde49f258d1bd0e094802a0e8399268
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/feedback/src/main/ets/view/FeedbackListPage.ets
arkts
FeedbackListContent
反馈列表页面内容视图 @returns {void} 无返回值
@Builder private FeedbackListContent() { Text("反馈列表页面内容视图") }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private FeedbackListContent 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 Text ( AST#expression#Left "反馈列表页面内容视图" AST#expression#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 private FeedbackListContent() { Text("反馈列表页面内容视图") }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/feedback/src/main/ets/view/FeedbackListPage.ets#L33-L36
6460fda91915b15cc799887d6965d4059f80ec2b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TempUtil.ets
arkts
F2C
华氏度转摄氏度 @param f 华氏度 @return 摄氏度
static F2C(f: number): number { return (f - 32) * (5 / 9) }
AST#method_declaration#Left static F2C AST#parameter_list#Left ( AST#parameter#Left f : 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#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left f AST#expression#Right - AST#expression#Left 32 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 5 AST#expression#Right / AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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 F2C(f: number): number { return (f - 32) * (5 / 9) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TempUtil.ets#L39-L41
07efab8290b039c9e3fc432361f41b0f35fd1faa
gitee
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
分享文章 @param date @returns
export function shareArticle(title:string,link:string) { return axiosClient.post<any>({ url: `lg/user_article/add/json`, checkResultCode:true, needJumpToLogin:true, checkLoginState:true, params: { 'title':title, 'link':link, } }) }
AST#export_declaration#Left export AST#function_declaration#Left function shareArticle AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left link : 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axiosClient AST#expression#Right . post AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left any 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 url AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` lg/user_article/add/json ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left checkResultCode 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 needJumpToLogin 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 checkLoginState 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 params AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'title' AST#property_name#Right : AST#expression#Left title AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'link' AST#property_name#Right : AST#expression#Left link 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#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 shareArticle(title:string,link:string) { return axiosClient.post<any>({ url: `lg/user_article/add/json`, checkResultCode:true, needJumpToLogin:true, checkLoginState:true, params: { 'title':title, 'link':link, } }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L240-L251
50b373048e5c2f133d484711c6fc411ff46a967d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/SearchPage.ets
arkts
buildGreetingResults
构建祝福语搜索结果
@Builder buildGreetingResults() { Column({ space: 12 }) { Text(`祝福语 (${this.searchResult.greetings.length})`) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Column({ space: 1 }) { ForEach(this.searchResult.greetings.slice(0, this.activeTab === 'greetings' ? 50 : 3), (greeting: Greeting) => { this.buildGreetingResultItem(greeting) }) if (this.activeTab === 'all' && this.searchResult.greetings.length > 3) { Row() { Text(`查看全部${this.searchResult.greetings.length}条祝福语`) .fontSize(14) .fontColor('#007AFF') } .width('100%') .height(48) .justifyContent(FlexAlign.Center) .backgroundColor('#f8f9fa') .onClick(() => { this.onTabChange('greetings'); }) } } .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingResults AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_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 . searchResult AST#member_expression#Right AST#expression#Right . greetings 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 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' 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#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 Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 1 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#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 this AST#expression#Right . searchResult AST#member_expression#Right AST#expression#Right . greetings AST#member_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 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 . activeTab AST#member_expression#Right AST#expression#Right === AST#expression#Left 'greetings' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 50 AST#expression#Right : AST#expression#Left 3 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left greeting : AST#type_annotation#Left AST#primary_type#Left Greeting 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 . buildGreetingResultItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left greeting 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#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 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 . activeTab AST#member_expression#Right AST#expression#Right === AST#expression#Left 'all' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . searchResult AST#member_expression#Right AST#expression#Right . greetings AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 3 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 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#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 . searchResult AST#member_expression#Right AST#expression#Right . greetings 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 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#007AFF' 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 . height ( AST#expression#Left 48 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 . backgroundColor ( AST#expression#Left '#f8f9fa' 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 . onTabChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'greetings' 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.1)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 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#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 buildGreetingResults() { Column({ space: 12 }) { Text(`祝福语 (${this.searchResult.greetings.length})`) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor('#333333') .alignSelf(ItemAlign.Start) Column({ space: 1 }) { ForEach(this.searchResult.greetings.slice(0, this.activeTab === 'greetings' ? 50 : 3), (greeting: Greeting) => { this.buildGreetingResultItem(greeting) }) if (this.activeTab === 'all' && this.searchResult.greetings.length > 3) { Row() { Text(`查看全部${this.searchResult.greetings.length}条祝福语`) .fontSize(14) .fontColor('#007AFF') } .width('100%') .height(48) .justifyContent(FlexAlign.Center) .backgroundColor('#f8f9fa') .onClick(() => { this.onTabChange('greetings'); }) } } .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 8, color: 'rgba(0,0,0,0.1)', offsetX: 0, offsetY: 2 }) } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L535-L573
ab20272074a4f62bcd2897a94abbe04ef674c658
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/pages/PublishMultimediaUpdates.ets
arkts
PublishMultimediaUpdates
功能描述: 本示例主要介绍使用@ohos.file.photoAccessHelper实现访问系统相册获取媒体资源的多媒体发布场景 推荐场景: 需要调用系统图库的场景,如:上传图库图片、发布朋友圈等 核心组件: 1. CommentInputDialog 实现步骤: 1.使用LazyForEach+cacheCount+@Reusable实现懒加载列表。 2.创建ListScroller对象,将ListScroller对象绑定到List组件内。 3.在需要记录当前位置时通过currentOffset方法存储当前偏移量historyOffset,在需要跳转时用scrollTo方法跳转。
@Component export struct PublishMultimediaUpdates { private cachedCountNumber: number = 3; // 懒加载缓存数 @State toolbarList: ToolBarOptions = new ToolBarOptions() private controller1: TabsController = new TabsController() listScroller: ListScroller = new ListScroller(); // scroller控制器 @State commentList: CommentData = new CommentData(); // 评论列表 @State textInComment: string = ""; // 评论中的文字 @State imageInComment: string = ''; // 评论中的图片列表 @State videoInComment: string = '' // 评论中的视频列表 @State dialogType: string = typeText; // 弹窗类型 private scroller: ListScroller = new ListScroller(); // 评论输入弹窗 dialogController: CustomDialogController | null = new CustomDialogController({ builder: CommentInputDialog({ textInComment: $textInComment, imagesInComment: $imageInComment, videoInComment: $videoInComment, dialogType: $dialogType, publish: () => this.publishComment() }), autoCancel: true, alignment: DialogAlignment.Bottom, customStyle: true, offset: { dx: $r('app.integer.image_comment_dialog_offset_x'), dy: $r('app.integer.image_comment_dialog_offset_y') } }); aboutToAppear(): void { // 加载初始数据 this.commentList = mockData(); // 加载toolbar数据 this.toolbarList.push({ content: $r('app.string.toolbarList_home'), icon: $r('app.media.backgroundblur_main_normal'), action: () => { }, state: ItemState.ACTIVATE }) this.toolbarList.push({ content: $r('app.string.toolbarList_discover'), icon: $r('app.media.backgroundblur_find_normal'), action: () => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }, }) this.toolbarList.push({ content: $r('app.string.toolbarList_Super_Group'), icon: $r('app.media.backgroundblur_hot_normal'), action: () => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }, }) this.toolbarList.push({ content: $r('app.string.toolbarList_Message'), icon: $r('sys.media.ohos_ic_public_email'), action: () => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }, }) this.toolbarList.push({ content: $r('app.string.toolbarList_more'), icon: $r('sys.media.ohos_ic_public_more'), action: () => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }, }) } getCurrentDate(): string { const date: Date = new Date(); return `${date.getFullYear()}-${date.getMonth()}-${date.getDay()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`; } publishComment(): void { // 发布图片,须有选择图片 if (this.dialogType == typeImage) { if (this.imageInComment !== undefined && this.imageInComment !== '') { const comment: FriendMoment = new FriendMoment(this.getCurrentDate(), "我的", $r("app.media.publish_multimedia_updates_photo0"), this.textInComment, this.imageInComment); this.commentList.addDataFirst(comment); } else { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_input_image'), }); } } else if (this.dialogType == typeVideo) { // 发布视频,须有视频 if (this.videoInComment !== undefined && this.videoInComment !== '') { const comment: FriendMoment = new FriendMoment(this.getCurrentDate(), "我的", $r("app.media.publish_multimedia_updates_photo0"), this.textInComment, '', this.videoInComment); this.commentList.addDataFirst(comment); } else { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_input_video'), }); } } else if (this.dialogType == typeText) { if (this.textInComment) { const comment: FriendMoment = new FriendMoment(this.getCurrentDate(), "我的", $r("app.media.publish_multimedia_updates_photo0"), this.textInComment); this.commentList.addDataFirst(comment); } else { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_input_comment'), }); } } this.scroller.scrollToIndex(0, true, ScrollAlign.START); } aboutToDisappear() { // 将dialogController置空 this.dialogController = null; } @Builder MyMenu() { Menu() { MenuItem({ startIcon: $r("sys.media.ohos_ic_public_text"), content: $r('app.string.publish_multimedia_updates_post') }) .onClick(() => { this.dialogType = typeText if (this.dialogController !== null) { // 打开评论输入弹窗 this.dialogController.open(); } }) .id('Post') MenuItem({ startIcon: $r("sys.media.save_button_picture"), content: $r('app.string.publish_multimedia_updates_photo') }) .onClick(() => { this.dialogType = typeImage if (this.dialogController !== null) { // 打开评论输入弹窗 this.dialogController.open(); } }) .id('Photo') MenuItem({ startIcon: $r("sys.media.ohos_ic_public_video"), content: $r('app.string.publish_multimedia_updates_video') }) .onClick(() => { this.dialogType = typeVideo if (this.dialogController !== null) { // 打开评论输入弹窗 this.dialogController.open(); } }) .id('Video') MenuItem({ startIcon: $r("app.media.review"), content: $r('app.string.publish_multimedia_updates_review') }) .onClick(() => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }) MenuItem({ startIcon: $r("sys.media.ohos_ic_public_camera"), content: $r('app.string.publish_multimedia_updates_live') }) .onClick(() => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }) } .width($r('app.string.publish_multimedia_updates_layout_40')) } @Builder MyADD() { Image($r('sys.media.ohos_ic_public_add')) .bindMenu(this.MyMenu()) .width($r('app.string.publish_multimedia_updates_layout_40')) .height($r('app.string.publish_multimedia_updates_layout_40')) .position({ top: 20, right: 5 }) .id('add_button') } @Builder Camera() { Image($r('sys.media.ohos_ic_public_camera')) .width($r('app.string.publish_multimedia_updates_layout_30')) .position({ top: 15, left: 10 }) } build() { Row() { Tabs({ controller: this.controller1, index: 1 }) { TabContent() { }.tabBar(this.Camera()) TabContent() { Column() { List({ space: ListConstants.LIST_SPACE, scroller: this.listScroller }) { // TODO:高性能知识点:列表数据较多,不需要全部渲染上屏,采用LazyForEach。 LazyForEach(this.commentList, (moment: FriendMoment) => { ListItem() { OneMoment({ moment: moment }); } }, (moment: FriendMoment) => moment.id) } // TODO:高性能知识点:为保证滑动流畅,采用cachedCount缓存前后节点。 .cachedCount(this.cachedCountNumber) .width($r('app.string.publish_multimedia_updates_layout_100')) .layoutWeight(1) .listDirection(Axis.Vertical) .divider({ strokeWidth: $r('app.integer.publish_multimedia_updates_divider_width'), color: $r('app.color.publish_multimedia_updates_divider_color'), startMargin: $r('app.integer.publish_multimedia_updates_list_divider_margin'), endMargin: $r('app.integer.publish_multimedia_updates_list_divider_margin') }) ToolBar({ activateIndex: 0, toolBarList: this.toolbarList, }) .height($r('app.integer.toolbar_height')) } .height($r('app.string.publish_multimedia_updates_layout_100')) .width($r('app.string.publish_multimedia_updates_layout_100')) }.tabBar($r('app.string.publish_multimedia_updates_following')) .height($r('app.string.publish_multimedia_updates_layout_100')) .width($r('app.string.publish_multimedia_updates_layout_100')) TabContent() { Column() .width($r('app.string.publish_multimedia_updates_layout_100')) .height($r('app.string.publish_multimedia_updates_layout_100')) .backgroundColor(Color.Blue) }.tabBar($r('app.string.publish_multimedia_updates_for_you')) TabContent() { }.tabBar(this.MyADD()) } .onContentWillChange((currentIndex, comingIndex) => { if (comingIndex == 0 || comingIndex == 2 || comingIndex == 3) { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); return false } if (comingIndex == 0) { return false } return true }) .vertical(false) .barMode(BarMode.Fixed) .height($r('app.string.publish_multimedia_updates_layout_100')) .width($r('app.string.publish_multimedia_updates_layout_100')) .barWidth($r('app.integer.publish_multimedia_updates_list_barwidth')) .barHeight($r('app.integer.publish_multimedia_updates_list_barheight')) } .alignItems(VerticalAlign.Center) .height($r('app.string.publish_multimedia_updates_layout_100')) .width($r('app.string.publish_multimedia_updates_layout_100')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PublishMultimediaUpdates AST#component_body#Left { AST#property_declaration#Left private cachedCountNumber : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right // 懒加载缓存数 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right toolbarList : AST#type_annotation#Left AST#primary_type#Left ToolBarOptions 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 ToolBarOptions 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 private controller1 AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left TabsController 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 TabsController 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 listScroller AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left ListScroller 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 ListScroller 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 // scroller控制器 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right commentList : AST#type_annotation#Left AST#primary_type#Left CommentData 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 CommentData 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 textInComment : 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 AST#decorator#Left @ State AST#decorator#Right imageInComment : 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 AST#decorator#Left @ State AST#decorator#Right videoInComment : 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 AST#decorator#Left @ State AST#decorator#Right dialogType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left typeText AST#expression#Right ; AST#property_declaration#Right // 弹窗类型 AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left ListScroller 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 ListScroller 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 dialogController : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CustomDialogController 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#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 CommentInputDialog AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left textInComment AST#property_name#Right : AST#expression#Left $textInComment AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imagesInComment AST#property_name#Right : AST#expression#Left $imageInComment AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left videoInComment AST#property_name#Right : AST#expression#Left $videoInComment AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dialogType AST#property_name#Right : AST#expression#Left $dialogType AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left publish AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . publishComment 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#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 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#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 offset AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dx AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.image_comment_dialog_offset_x' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dy AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.image_comment_dialog_offset_y' AST#expression#Right ) AST#resource_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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right 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 . commentList AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left mockData 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 // 加载toolbar数据 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 . toolbarList AST#member_expression#Right AST#expression#Right . push 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 content AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.toolbarList_home' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.backgroundblur_main_normal' AST#expression#Right ) AST#resource_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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left state AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemState AST#expression#Right . ACTIVATE 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#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 . toolbarList AST#member_expression#Right AST#expression#Right . push 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 content AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.toolbarList_discover' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.backgroundblur_find_normal' AST#expression#Right ) AST#resource_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#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.publish_multimedia_updates_other_function' 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#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#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 . toolbarList AST#member_expression#Right AST#expression#Right . push 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 content AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.toolbarList_Super_Group' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.backgroundblur_hot_normal' AST#expression#Right ) AST#resource_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#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.publish_multimedia_updates_other_function' 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#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#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 . toolbarList AST#member_expression#Right AST#expression#Right . push 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 content AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.toolbarList_Message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.media.ohos_ic_public_email' AST#expression#Right ) AST#resource_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#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.publish_multimedia_updates_other_function' 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#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#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 . toolbarList AST#member_expression#Right AST#expression#Right . push 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 content AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.toolbarList_more' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.media.ohos_ic_public_more' AST#expression#Right ) AST#resource_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#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.publish_multimedia_updates_other_function' 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#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 AST#method_declaration#Left getCurrentDate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left date : AST#type_annotation#Left AST#primary_type#Left Date 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 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return 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 date AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getDay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getSeconds AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left publishComment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 发布图片,须有选择图片 AST#statement#Left AST#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 . dialogType AST#member_expression#Right AST#expression#Right == AST#expression#Left typeImage AST#expression#Right AST#binary_expression#Right AST#expression#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 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 . imageInComment AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageInComment AST#member_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 comment : AST#type_annotation#Left AST#primary_type#Left FriendMoment 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 FriendMoment 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 this AST#expression#Right . getCurrentDate 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#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.publish_multimedia_updates_photo0" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInComment AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageInComment 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#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 . commentList AST#member_expression#Right AST#expression#Right . addDataFirst AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left comment 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 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.publish_multimedia_updates_input_image' 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#if_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#member_expression#Left AST#expression#Left this AST#expression#Right . dialogType AST#member_expression#Right AST#expression#Right == AST#expression#Left typeVideo AST#expression#Right AST#binary_expression#Right AST#expression#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 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 . videoInComment AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . videoInComment AST#member_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 comment : AST#type_annotation#Left AST#primary_type#Left FriendMoment 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 FriendMoment 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 this AST#expression#Right . getCurrentDate 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#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.publish_multimedia_updates_photo0" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInComment AST#member_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoInComment 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#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 . commentList AST#member_expression#Right AST#expression#Right . addDataFirst AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left comment 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 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.publish_multimedia_updates_input_video' 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#if_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#member_expression#Left AST#expression#Left this AST#expression#Right . dialogType AST#member_expression#Right AST#expression#Right == AST#expression#Left typeText AST#expression#Right AST#binary_expression#Right AST#expression#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 . textInComment AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left comment : AST#type_annotation#Left AST#primary_type#Left FriendMoment 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 FriendMoment 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 this AST#expression#Right . getCurrentDate 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#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.publish_multimedia_updates_photo0" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInComment 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#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 . commentList AST#member_expression#Right AST#expression#Right . addDataFirst AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left comment 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 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.publish_multimedia_updates_input_comment' 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#if_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#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 . scroller AST#member_expression#Right AST#expression#Right . scrollToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , 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 ScrollAlign AST#expression#Right . START 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#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 将dialogController置空 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#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 AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MyMenu 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 Menu ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "sys.media.ohos_ic_public_text" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_post' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#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 . dialogType AST#member_expression#Right = AST#expression#Left typeText AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_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 . dialogController 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#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#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#Left . id ( AST#expression#Left 'Post' 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 MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "sys.media.save_button_picture" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_photo' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#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 . dialogType AST#member_expression#Right = AST#expression#Left typeImage AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_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 . dialogController 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#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#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#Left . id ( AST#expression#Left 'Photo' 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 MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "sys.media.ohos_ic_public_video" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_video' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#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 . dialogType AST#member_expression#Right = AST#expression#Left typeVideo AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_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 . dialogController 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#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#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#Left . id ( AST#expression#Left 'Video' 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 MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.review" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_review' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#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 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.publish_multimedia_updates_other_function' 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#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 MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "sys.media.ohos_ic_public_camera" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_live' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#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 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.publish_multimedia_updates_other_function' 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#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 AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_layout_40' 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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MyADD 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.media.ohos_ic_public_add' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . bindMenu ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . MyMenu AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_layout_40' 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.publish_multimedia_updates_layout_40' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'add_button' 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#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right Camera 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.media.ohos_ic_public_camera' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_layout_30' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 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#builder_function_body#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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Tabs ( AST#component_parameters#Left { AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller1 AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left index : AST#expression#Left 1 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 TabContent ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . tabBar ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Camera AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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 TabContent ( ) 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 List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left ListConstants AST#expression#Right . LIST_SPACE AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listScroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // TODO:高性能知识点:列表数据较多,不需要全部渲染上屏,采用LazyForEach。 AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentList AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left moment : AST#type_annotation#Left AST#primary_type#Left FriendMoment 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#ui_custom_component_statement#Left OneMoment ( AST#component_parameters#Left { AST#component_parameter#Left moment : AST#expression#Left moment 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_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left moment : AST#type_annotation#Left AST#primary_type#Left FriendMoment 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 moment AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right // TODO:高性能知识点:为保证滑动流畅,采用cachedCount缓存前后节点。 AST#modifier_chain_expression#Left . cachedCount ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cachedCountNumber AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_layout_100' AST#expression#Right ) AST#resource_expression#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 . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.publish_multimedia_updates_divider_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.publish_multimedia_updates_divider_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left startMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.publish_multimedia_updates_list_divider_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.publish_multimedia_updates_list_divider_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#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 ToolBar ( AST#component_parameters#Left { AST#component_parameter#Left activateIndex : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toolBarList : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toolbarList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.toolbar_height' 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#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_layout_100' 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.publish_multimedia_updates_layout_100' AST#expression#Right ) AST#resource_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 . tabBar ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_following' 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.publish_multimedia_updates_layout_100' 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.publish_multimedia_updates_layout_100' 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#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 TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_layout_100' 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.publish_multimedia_updates_layout_100' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . tabBar ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_for_you' 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 TabContent ( ) AST#container_content_body#Left { } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . tabBar ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . MyADD AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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#modifier_chain_expression#Left . onContentWillChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left currentIndex AST#parameter#Right , AST#parameter#Left comingIndex AST#parameter#Right ) 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left comingIndex AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left comingIndex AST#expression#Right == AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left comingIndex AST#expression#Right == AST#expression#Left 3 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#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.publish_multimedia_updates_other_function' 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#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_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 comingIndex 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#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_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#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . vertical ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . barMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarMode AST#expression#Right . Fixed AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_layout_100' 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.publish_multimedia_updates_layout_100' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . barWidth ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.publish_multimedia_updates_list_barwidth' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . barHeight ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.publish_multimedia_updates_list_barheight' 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#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 . 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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_layout_100' 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.publish_multimedia_updates_layout_100' 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#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 PublishMultimediaUpdates { private cachedCountNumber: number = 3; @State toolbarList: ToolBarOptions = new ToolBarOptions() private controller1: TabsController = new TabsController() listScroller: ListScroller = new ListScroller(); @State commentList: CommentData = new CommentData(); @State textInComment: string = ""; @State imageInComment: string = ''; @State videoInComment: string = '' @State dialogType: string = typeText; private scroller: ListScroller = new ListScroller(); dialogController: CustomDialogController | null = new CustomDialogController({ builder: CommentInputDialog({ textInComment: $textInComment, imagesInComment: $imageInComment, videoInComment: $videoInComment, dialogType: $dialogType, publish: () => this.publishComment() }), autoCancel: true, alignment: DialogAlignment.Bottom, customStyle: true, offset: { dx: $r('app.integer.image_comment_dialog_offset_x'), dy: $r('app.integer.image_comment_dialog_offset_y') } }); aboutToAppear(): void { this.commentList = mockData(); this.toolbarList.push({ content: $r('app.string.toolbarList_home'), icon: $r('app.media.backgroundblur_main_normal'), action: () => { }, state: ItemState.ACTIVATE }) this.toolbarList.push({ content: $r('app.string.toolbarList_discover'), icon: $r('app.media.backgroundblur_find_normal'), action: () => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }, }) this.toolbarList.push({ content: $r('app.string.toolbarList_Super_Group'), icon: $r('app.media.backgroundblur_hot_normal'), action: () => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }, }) this.toolbarList.push({ content: $r('app.string.toolbarList_Message'), icon: $r('sys.media.ohos_ic_public_email'), action: () => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }, }) this.toolbarList.push({ content: $r('app.string.toolbarList_more'), icon: $r('sys.media.ohos_ic_public_more'), action: () => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }, }) } getCurrentDate(): string { const date: Date = new Date(); return `${date.getFullYear()}-${date.getMonth()}-${date.getDay()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`; } publishComment(): void { if (this.dialogType == typeImage) { if (this.imageInComment !== undefined && this.imageInComment !== '') { const comment: FriendMoment = new FriendMoment(this.getCurrentDate(), "我的", $r("app.media.publish_multimedia_updates_photo0"), this.textInComment, this.imageInComment); this.commentList.addDataFirst(comment); } else { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_input_image'), }); } } else if (this.dialogType == typeVideo) { if (this.videoInComment !== undefined && this.videoInComment !== '') { const comment: FriendMoment = new FriendMoment(this.getCurrentDate(), "我的", $r("app.media.publish_multimedia_updates_photo0"), this.textInComment, '', this.videoInComment); this.commentList.addDataFirst(comment); } else { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_input_video'), }); } } else if (this.dialogType == typeText) { if (this.textInComment) { const comment: FriendMoment = new FriendMoment(this.getCurrentDate(), "我的", $r("app.media.publish_multimedia_updates_photo0"), this.textInComment); this.commentList.addDataFirst(comment); } else { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_input_comment'), }); } } this.scroller.scrollToIndex(0, true, ScrollAlign.START); } aboutToDisappear() { this.dialogController = null; } @Builder MyMenu() { Menu() { MenuItem({ startIcon: $r("sys.media.ohos_ic_public_text"), content: $r('app.string.publish_multimedia_updates_post') }) .onClick(() => { this.dialogType = typeText if (this.dialogController !== null) { this.dialogController.open(); } }) .id('Post') MenuItem({ startIcon: $r("sys.media.save_button_picture"), content: $r('app.string.publish_multimedia_updates_photo') }) .onClick(() => { this.dialogType = typeImage if (this.dialogController !== null) { this.dialogController.open(); } }) .id('Photo') MenuItem({ startIcon: $r("sys.media.ohos_ic_public_video"), content: $r('app.string.publish_multimedia_updates_video') }) .onClick(() => { this.dialogType = typeVideo if (this.dialogController !== null) { this.dialogController.open(); } }) .id('Video') MenuItem({ startIcon: $r("app.media.review"), content: $r('app.string.publish_multimedia_updates_review') }) .onClick(() => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }) MenuItem({ startIcon: $r("sys.media.ohos_ic_public_camera"), content: $r('app.string.publish_multimedia_updates_live') }) .onClick(() => { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); }) } .width($r('app.string.publish_multimedia_updates_layout_40')) } @Builder MyADD() { Image($r('sys.media.ohos_ic_public_add')) .bindMenu(this.MyMenu()) .width($r('app.string.publish_multimedia_updates_layout_40')) .height($r('app.string.publish_multimedia_updates_layout_40')) .position({ top: 20, right: 5 }) .id('add_button') } @Builder Camera() { Image($r('sys.media.ohos_ic_public_camera')) .width($r('app.string.publish_multimedia_updates_layout_30')) .position({ top: 15, left: 10 }) } build() { Row() { Tabs({ controller: this.controller1, index: 1 }) { TabContent() { }.tabBar(this.Camera()) TabContent() { Column() { List({ space: ListConstants.LIST_SPACE, scroller: this.listScroller }) { LazyForEach(this.commentList, (moment: FriendMoment) => { ListItem() { OneMoment({ moment: moment }); } }, (moment: FriendMoment) => moment.id) } .cachedCount(this.cachedCountNumber) .width($r('app.string.publish_multimedia_updates_layout_100')) .layoutWeight(1) .listDirection(Axis.Vertical) .divider({ strokeWidth: $r('app.integer.publish_multimedia_updates_divider_width'), color: $r('app.color.publish_multimedia_updates_divider_color'), startMargin: $r('app.integer.publish_multimedia_updates_list_divider_margin'), endMargin: $r('app.integer.publish_multimedia_updates_list_divider_margin') }) ToolBar({ activateIndex: 0, toolBarList: this.toolbarList, }) .height($r('app.integer.toolbar_height')) } .height($r('app.string.publish_multimedia_updates_layout_100')) .width($r('app.string.publish_multimedia_updates_layout_100')) }.tabBar($r('app.string.publish_multimedia_updates_following')) .height($r('app.string.publish_multimedia_updates_layout_100')) .width($r('app.string.publish_multimedia_updates_layout_100')) TabContent() { Column() .width($r('app.string.publish_multimedia_updates_layout_100')) .height($r('app.string.publish_multimedia_updates_layout_100')) .backgroundColor(Color.Blue) }.tabBar($r('app.string.publish_multimedia_updates_for_you')) TabContent() { }.tabBar(this.MyADD()) } .onContentWillChange((currentIndex, comingIndex) => { if (comingIndex == 0 || comingIndex == 2 || comingIndex == 3) { promptAction.showToast({ message: $r('app.string.publish_multimedia_updates_other_function'), }); return false } if (comingIndex == 0) { return false } return true }) .vertical(false) .barMode(BarMode.Fixed) .height($r('app.string.publish_multimedia_updates_layout_100')) .width($r('app.string.publish_multimedia_updates_layout_100')) .barWidth($r('app.integer.publish_multimedia_updates_list_barwidth')) .barHeight($r('app.integer.publish_multimedia_updates_list_barheight')) } .alignItems(VerticalAlign.Center) .height($r('app.string.publish_multimedia_updates_layout_100')) .width($r('app.string.publish_multimedia_updates_layout_100')) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/pages/PublishMultimediaUpdates.ets#L39-L328
4e033775ec077ee382dd1c0fd5f0199220dd8417
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/class.ets
arkts
trainContent
**************************主体内容**************************//
@Builder trainContent() { Column() { Column() { //热身 Row() { Text('热身·'+this.warmUpArry.length+'个') .width('80%') .fontSize(20) .fontWeight(FontWeight.Bold) Toggle({ type: ToggleType.Switch, isOn: this.isOnWarm }) .onChange((isOn: boolean) => { this.isOnWarm = isOn console.log('开关状态:', isOn); }) .width(50) .height(30) } .width('100%') Column() { ForEach(this.warmUpArry, (data: string, index: number) => { this.warmUpItemUI(data, index) }) } .border({ width: { top: 0, bottom: 1, left: 0, right: 0 }, color: { top: '#F2F4F6', bottom: '#F2F4F6' } }) .margin(20) .width('100%') //训练 Row() { Text('训练·'+this.trainArry.length+'个') .width('80%') .fontSize(20) .fontWeight(FontWeight.Bold) } .width('100%') Column() { ForEach(this.trainArry, (data: string, index: number) => { this.trainItemUI(data, index) }) } .width('100%') .margin({ top: 20 }) } .margin({ top: 15 }) //拉伸放松 Row() { Text('拉伸放松·'+this.relaxArry.length+'个') .width('80%') .fontSize(20) .fontWeight(FontWeight.Bold) Toggle({ type: ToggleType.Switch, isOn: this.isOnRelax }) .onChange((isOn: boolean) => { this.isOnRelax = isOn console.log('开关状态:', isOn); }) .width(50) .height(30) } .width('100%') Column() { ForEach(this.relaxArry, (data: string, index: number) => { this.relaxItemUI(data, index) }) } .border({ width: { top: 0, bottom: 1, left: 0, right: 0 }, color: { top: '#F2F4F6', bottom: '#F2F4F6' } }) .width('100%') } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right trainContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#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#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#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . warmUpArry AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left '个' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' 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 AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold 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 Toggle ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Switch AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOnWarm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isOn : 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#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 . isOnWarm AST#member_expression#Right = AST#expression#Left isOn 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#expression#Right , AST#expression#Left isOn 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#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 30 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#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 Column ( ) 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 . warmUpArry AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . warmUpItemUI AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left index 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#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 0 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 color AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left '#F2F4F6' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left '#F2F4F6' 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#modifier_chain_expression#Left . margin ( AST#expression#Left 20 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#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 Text ( 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#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . trainArry AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left '个' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' 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 AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold 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#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#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#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . trainArry AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . trainItemUI AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left index 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#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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 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#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 15 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#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#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#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . relaxArry AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left '个' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' 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 AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold 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 Toggle ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Switch AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOnRelax AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isOn : 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#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 . isOnRelax AST#member_expression#Right = AST#expression#Left isOn 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#expression#Right , AST#expression#Left isOn 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#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 30 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#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 Column ( ) 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 . relaxArry AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . relaxItemUI AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left index 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#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 0 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 color AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left '#F2F4F6' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left '#F2F4F6' 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#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder trainContent() { Column() { Column() { Row() { Text('热身·'+this.warmUpArry.length+'个') .width('80%') .fontSize(20) .fontWeight(FontWeight.Bold) Toggle({ type: ToggleType.Switch, isOn: this.isOnWarm }) .onChange((isOn: boolean) => { this.isOnWarm = isOn console.log('开关状态:', isOn); }) .width(50) .height(30) } .width('100%') Column() { ForEach(this.warmUpArry, (data: string, index: number) => { this.warmUpItemUI(data, index) }) } .border({ width: { top: 0, bottom: 1, left: 0, right: 0 }, color: { top: '#F2F4F6', bottom: '#F2F4F6' } }) .margin(20) .width('100%') Row() { Text('训练·'+this.trainArry.length+'个') .width('80%') .fontSize(20) .fontWeight(FontWeight.Bold) } .width('100%') Column() { ForEach(this.trainArry, (data: string, index: number) => { this.trainItemUI(data, index) }) } .width('100%') .margin({ top: 20 }) } .margin({ top: 15 }) Row() { Text('拉伸放松·'+this.relaxArry.length+'个') .width('80%') .fontSize(20) .fontWeight(FontWeight.Bold) Toggle({ type: ToggleType.Switch, isOn: this.isOnRelax }) .onChange((isOn: boolean) => { this.isOnRelax = isOn console.log('开关状态:', isOn); }) .width(50) .height(30) } .width('100%') Column() { ForEach(this.relaxArry, (data: string, index: number) => { this.relaxItemUI(data, index) }) } .border({ width: { top: 0, bottom: 1, left: 0, right: 0 }, color: { top: '#F2F4F6', bottom: '#F2F4F6' } }) .width('100%') } }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/class.ets#L240-L323
052b513188532e9ffd169def6a7e33565121ba55
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/Utils.ets
arkts
TODO 工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class Utils { /** * 判断字符串是否为空(undefined、null、字符串长度为0) * @param str 被检测的字符串 * @return 是否为空 */ static isEmpty(str: string | undefined | null): boolean { return str === undefined || str === null || str.length === 0; } /** * 判断字符串是否为非空。true为非空空,否则false * @param str * @returns */ static isNotEmpty(str: string | undefined | null): boolean { return false === Utils.isEmpty(str); } /** * 通过URI或路径,获取FileUri * @param uriOrPath URI或路径 * @returns */ static getFileUri(uriOrPath: string): fileUri.FileUri { return new fileUri.FileUri(uriOrPath); } /** * 通过URI或路径,获取文件名。 * @param uriOrPath URI或路径 * @returns */ static getFileName(uriOrPath: string): string { return Utils.getFileUri(uriOrPath).name; } /** * 通过URI或路径,获取文件路径 * @param uriOrPath URI或路径 * @returns */ static getFilePath(uriOrPath: string): string { return Utils.getFileUri(uriOrPath).path; } /** * 以同步方法获取文件URI。 * @param path 应用沙箱路径 * @returns */ static getUriFromPath(path: string): string { return fileUri.getUriFromPath(path); } /** * 根据文件名获取文件后缀 * @param fileName 例如: test.txt test.doc * @returns */ static getFileExtention(fileName: string) { if (Utils.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; } /** * 打开文件,支持使用URI打开文件。使用Promise异步回调。 * @param path string 文件的应用沙箱路径或URI。 * @param mode number 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开。 * @returns */ static open(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): Promise<fs.File> { return fs.open(path, mode); } /** * 打开文件,支持使用URI打开文件。以同步方法。 * @param path string 文件的应用沙箱路径或URI。 * @param mode number 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开。 * @returns */ static openSync(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): fs.File { return fs.openSync(path, mode); } /** * 复制文件,使用Promise异步回调。 * @param src string|number 待复制文件的路径或待复制文件的文件描述符。 * @param dest string|number 目标文件路径或目标文件的文件描述符。 * @param mode number 提供覆盖文件的选项,当前仅支持0,且默认为0。0:完全覆盖目标文件。 * @returns */ static copyFile(src: string | number, dest: string | number, mode: number = 0): Promise<void> { return fs.copyFile(src, dest, mode); } /** * 以同步方法复制文件。 * @param src string|number 待复制文件的路径或待复制文件的文件描述符。 * @param dest string|number 目标文件路径或目标文件的文件描述符。 * @param mode number 提供覆盖文件的选项,当前仅支持0,且默认为0。0:完全覆盖目标文件。 */ static copyFileSync(src: string | number, dest: string | number, mode: number = 0) { fs.copyFileSync(src, dest, mode); } /** * 关闭文件,使用Promise异步回调。 * @param file 已打开的File对象或已打开的文件描述符fd。 * @returns */ static close(file: fs.File | number): Promise<void> { return fs.close(file); } /** * 关闭文件,以同步方法。 * @param file 已打开的File对象或已打开的文件描述符fd。 */ static closeSync(file: fs.File | number) { fs.closeSync(file); } }
AST#export_declaration#Left export AST#class_declaration#Left class Utils AST#class_body#Left { /** * 判断字符串是否为空(undefined、null、字符串长度为0) * @param str 被检测的字符串 * @return 是否为空 */ AST#method_declaration#Left static isEmpty 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 undefined 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 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#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#binary_expression#Left AST#expression#Left str AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left str 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#binary_expression#Right AST#expression#Right || AST#expression#Left str AST#expression#Right AST#binary_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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 判断字符串是否为非空。true为非空空,否则false * @param str * @returns */ AST#method_declaration#Left static isNotEmpty 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 undefined 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 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#binary_expression#Left AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right === AST#expression#Left Utils AST#expression#Right AST#binary_expression#Right AST#expression#Right . isEmpty AST#member_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 ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 通过URI或路径,获取FileUri * @param uriOrPath URI或路径 * @returns */ AST#method_declaration#Left static getFileUri AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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#qualified_type#Left fileUri . FileUri AST#qualified_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 AST#new_expression#Left new AST#expression#Left fileUri AST#expression#Right AST#new_expression#Right AST#expression#Right . FileUri AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uriOrPath 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 /** * 通过URI或路径,获取文件名。 * @param uriOrPath URI或路径 * @returns */ AST#method_declaration#Left static getFileName AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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#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 Utils AST#expression#Right . getFileUri AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uriOrPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 通过URI或路径,获取文件路径 * @param uriOrPath URI或路径 * @returns */ AST#method_declaration#Left static getFilePath AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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#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 Utils AST#expression#Right . getFileUri AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uriOrPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . path AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 以同步方法获取文件URI。 * @param path 应用沙箱路径 * @returns */ AST#method_declaration#Left static getUriFromPath AST#parameter_list#Left ( AST#parameter#Left path : 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path 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 /** * 根据文件名获取文件后缀 * @param fileName 例如: test.txt test.doc * @returns */ AST#method_declaration#Left static getFileExtention AST#parameter_list#Left ( AST#parameter#Left fileName : 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#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 Utils AST#expression#Right . isNotEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left fileName AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "." 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileName AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#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 fileName AST#expression#Right . lastIndexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "." AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_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#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 打开文件,支持使用URI打开文件。使用Promise异步回调。 * @param path string 文件的应用沙箱路径或URI。 * @param mode number 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开。 * @returns */ AST#method_declaration#Left static open AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : 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 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 fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE 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 AST#qualified_type#Left fs . File AST#qualified_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 fs AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left mode 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 /** * 打开文件,支持使用URI打开文件。以同步方法。 * @param path string 文件的应用沙箱路径或URI。 * @param mode number 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开。 * @returns */ AST#method_declaration#Left static openSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : 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 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 fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE AST#member_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fs . File AST#qualified_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 . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left mode 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 /** * 复制文件,使用Promise异步回调。 * @param src string|number 待复制文件的路径或待复制文件的文件描述符。 * @param dest string|number 目标文件路径或目标文件的文件描述符。 * @param mode number 提供覆盖文件的选项,当前仅支持0,且默认为0。0:完全覆盖目标文件。 * @returns */ AST#method_declaration#Left static copyFile AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dest : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : 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_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#member_expression#Left AST#expression#Left fs AST#expression#Right . copyFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left src AST#expression#Right , AST#expression#Left dest AST#expression#Right , AST#expression#Left mode 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 /** * 以同步方法复制文件。 * @param src string|number 待复制文件的路径或待复制文件的文件描述符。 * @param dest string|number 目标文件路径或目标文件的文件描述符。 * @param mode number 提供覆盖文件的选项,当前仅支持0,且默认为0。0:完全覆盖目标文件。 */ AST#method_declaration#Left static copyFileSync AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dest : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : 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_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 fs AST#expression#Right . copyFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left src AST#expression#Right , AST#expression#Left dest AST#expression#Right , AST#expression#Left mode 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 /** * 关闭文件,使用Promise异步回调。 * @param file 已打开的File对象或已打开的文件描述符fd。 * @returns */ AST#method_declaration#Left static close AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left fs . File AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left number 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 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#member_expression#Left AST#expression#Left fs AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file 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 /** * 关闭文件,以同步方法。 * @param file 已打开的File对象或已打开的文件描述符fd。 */ AST#method_declaration#Left static closeSync AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left fs . File AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left number 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . closeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file 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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Utils { static isEmpty(str: string | undefined | null): boolean { return str === undefined || str === null || str.length === 0; } static isNotEmpty(str: string | undefined | null): boolean { return false === Utils.isEmpty(str); } static getFileUri(uriOrPath: string): fileUri.FileUri { return new fileUri.FileUri(uriOrPath); } static getFileName(uriOrPath: string): string { return Utils.getFileUri(uriOrPath).name; } static getFilePath(uriOrPath: string): string { return Utils.getFileUri(uriOrPath).path; } static getUriFromPath(path: string): string { return fileUri.getUriFromPath(path); } static getFileExtention(fileName: string) { if (Utils.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; } static open(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): Promise<fs.File> { return fs.open(path, mode); } static openSync(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): fs.File { return fs.openSync(path, mode); } static copyFile(src: string | number, dest: string | number, mode: number = 0): Promise<void> { return fs.copyFile(src, dest, mode); } static copyFileSync(src: string | number, dest: string | number, mode: number = 0) { fs.copyFileSync(src, dest, mode); } static close(file: fs.File | number): Promise<void> { return fs.close(file); } static closeSync(file: fs.File | number) { fs.closeSync(file); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L24-L160
172e2f612a45fedf567709f3fc77ffad824a9033
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/components/ImageText.ets
arkts
ImageText
图片&文字组合
@Component export struct ImageText { @Prop imageStr: Resource; text: string | Resource = ''; build() { Row() { Image(this.imageStr) .height($r('app.integer.publish_multimedia_updates_handler_icon_height')) .width($r('app.integer.publish_multimedia_updates_handler_icon_width')) .objectFit(ImageFit.Contain) .autoResize(false) Text(this.text) .fontSize($r('app.integer.publish_multimedia_updates_handler_text_font_size')) .fontColor($r('app.color.publish_multimedia_updates_title_font_color')) .fontFamily($r('app.string.publish_multimedia_updates_harmony_hei_ti')) .opacity($r('app.float.publish_multimedia_updates_opacity')) .margin({ left: $r('app.integer.publish_multimedia_updates_layout') }) } .alignItems(VerticalAlign.Center) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageText AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right imageStr : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left text : 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#expression#Left '' 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#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 this AST#expression#Right . imageStr AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.publish_multimedia_updates_handler_icon_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.integer.publish_multimedia_updates_handler_icon_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . autoResize ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_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#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 this AST#expression#Right . text 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.integer.publish_multimedia_updates_handler_text_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.publish_multimedia_updates_title_font_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.publish_multimedia_updates_harmony_hei_ti' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.publish_multimedia_updates_opacity' 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 left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.publish_multimedia_updates_layout' 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 . 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#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 ImageText { @Prop imageStr: Resource; text: string | Resource = ''; build() { Row() { Image(this.imageStr) .height($r('app.integer.publish_multimedia_updates_handler_icon_height')) .width($r('app.integer.publish_multimedia_updates_handler_icon_width')) .objectFit(ImageFit.Contain) .autoResize(false) Text(this.text) .fontSize($r('app.integer.publish_multimedia_updates_handler_text_font_size')) .fontColor($r('app.color.publish_multimedia_updates_title_font_color')) .fontFamily($r('app.string.publish_multimedia_updates_harmony_hei_ti')) .opacity($r('app.float.publish_multimedia_updates_opacity')) .margin({ left: $r('app.integer.publish_multimedia_updates_layout') }) } .alignItems(VerticalAlign.Center) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/components/ImageText.ets#L20-L41
913c38cf21b0bf9ba5189d2e758ebfb9126b0315
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets
arkts
draw
RenderNode进行绘制时会调用draw方法
draw(context: DrawContext): void { const canvas = context.canvas; // 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制 const pen = new drawing.Pen(); // 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑 pen.setAntiAlias(true); pen.setColor(this.penColor); // 开启画笔的抖动绘制效果。抖动绘制可以使得绘制出的颜色更加真实。 pen.setDither(true); // 设置画笔的线宽为10px pen.setStrokeWidth(Constants.PEN_STROKE_WIDTH); // 将Pen画笔设置到canvas中 canvas.attachPen(pen); // 绘制path canvas.drawPath(this.path); }
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 // 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pen = 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#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 pen 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 pen AST#expression#Right . setColor 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 . penColor 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 pen 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 // 设置画笔的线宽为10px AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pen 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 Constants AST#expression#Right . PEN_STROKE_WIDTH 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 pen 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
draw(context: DrawContext): void { const canvas = context.canvas; const pen = new drawing.Pen(); pen.setAntiAlias(true); pen.setColor(this.penColor); pen.setDither(true); pen.setStrokeWidth(Constants.PEN_STROKE_WIDTH); canvas.attachPen(pen); canvas.drawPath(this.path); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L39-L54
1ab7d1d58118bd2b921b03615c10daec792b85a2
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets
arkts
getAllSearchHistory
获取所有搜索历史记录,按搜索时间倒序 @returns {Promise<SearchHistory[]>} 搜索历史列表
async getAllSearchHistory(): Promise<SearchHistory[]> { const list: SearchHistoryEntity[] = this.orm.query(SearchHistoryEntity).find(); return list .map((entity) => this.toModel(entity)) .sort((left, right) => (right.searchTime ?? 0) - (left.searchTime ?? 0)); }
AST#method_declaration#Left async getAllSearchHistory 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 SearchHistory [ ] 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#variable_declaration#Left const AST#variable_declarator#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SearchHistoryEntity [ ] AST#array_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#member_expression#Left AST#expression#Left this AST#expression#Right . orm AST#member_expression#Right AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left SearchHistoryEntity AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . find 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#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 list 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 entity AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toModel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left entity 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 . sort 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 left AST#parameter#Right , AST#parameter#Left right AST#parameter#Right ) AST#parameter_list#Right => 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#member_expression#Left AST#expression#Left right AST#expression#Right . searchTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left left AST#expression#Right . searchTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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 ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getAllSearchHistory(): Promise<SearchHistory[]> { const list: SearchHistoryEntity[] = this.orm.query(SearchHistoryEntity).find(); return list .map((entity) => this.toModel(entity)) .sort((left, right) => (right.searchTime ?? 0) - (left.searchTime ?? 0)); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L69-L74
8c55c9f2bba8ad45873e0c71a0a1b4aa79a5b916
github
AlbertZyc/tab-layout
4ba256eead3792c84128f8679b26ac159a2d7f06
entry/src/main/ets/BasicDataSource.ets
arkts
notifyDataAdd
通知LazyForEach组件需要在index对应索引处添加子组件
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#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 . listeners 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 listener => 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 listener AST#expression#Right . onDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index 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#builder_function_body#Right AST#method_declaration#Right
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L45-L49
4ea2d8f22cb16b45386e16df5ed3de4a488fc554
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
openSnapshotEditDialog
打开图片裁剪弹窗 @param uri
openSnapshotEditDialog(uri: string): void { DialogUtil.showCustomDialog({ dialogId: this.dialogId, builder: wrapBuilder(imageEditDialogBuilder), dialogType: DialogTypeEnum.BOTTOM, builderParam: { onConfirm: (isCloseDialog?: boolean, data?: ESObject) => { if (isCloseDialog) { DialogUtil.closeCustomDialogById(this.dialogId); loading($r('app.string.addressrecognize_recognize_text')).then((loadingId) => { this.loadingId = loadingId; this.recognizeImageToText(data); }); } else { promptAction.showToast({ message: data, duration: CommonConstants.TOAST_DURATION }); } }, data: new ImageEditParam(uri, this.bottomHeight) }, isSlideToClose: false, isModalClosedByOverlayClick: false }); }
AST#method_declaration#Left openSnapshotEditDialog AST#parameter_list#Left ( AST#parameter#Left uri : 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#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 DialogUtil AST#expression#Right . showCustomDialog 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 dialogId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left builder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageEditDialogBuilder 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 dialogType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogTypeEnum AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left builderParam AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onConfirm AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isCloseDialog ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left ESObject 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 isCloseDialog 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 DialogUtil AST#expression#Right . closeCustomDialogById 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 . dialogId 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#call_expression#Left AST#expression#Left loading AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.addressrecognize_recognize_text' AST#expression#Right ) AST#resource_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 loadingId 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 . loadingId AST#member_expression#Right = AST#expression#Left loadingId 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 . recognizeImageToText 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#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 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 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 data AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TOAST_DURATION 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#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#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImageEditParam AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomHeight 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isSlideToClose AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isModalClosedByOverlayClick 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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
openSnapshotEditDialog(uri: string): void { DialogUtil.showCustomDialog({ dialogId: this.dialogId, builder: wrapBuilder(imageEditDialogBuilder), dialogType: DialogTypeEnum.BOTTOM, builderParam: { onConfirm: (isCloseDialog?: boolean, data?: ESObject) => { if (isCloseDialog) { DialogUtil.closeCustomDialogById(this.dialogId); loading($r('app.string.addressrecognize_recognize_text')).then((loadingId) => { this.loadingId = loadingId; this.recognizeImageToText(data); }); } else { promptAction.showToast({ message: data, duration: CommonConstants.TOAST_DURATION }); } }, data: new ImageEditParam(uri, this.bottomHeight) }, isSlideToClose: false, isModalClosedByOverlayClick: false }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets#L242-L267
ef6d2245ca2549d22290b0693054d985677b7772
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/harB/index.ets
arkts
harBuilder
Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { harBuilder } from './src/main/ets/components/mainpage/HarB';
AST#export_declaration#Left export { harBuilder } from './src/main/ets/components/mainpage/HarB' ; AST#export_declaration#Right
export { harBuilder } from './src/main/ets/components/mainpage/HarB';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/harB/index.ets#L16-L16
667683db5fb6d54c288ec552894abde03b332094
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/products/phone/entry/src/main/ets/view/CustomDialogExample.ets
arkts
CustomDialogExample
首页右上角点击加号时弹出的列表
@CustomDialog export struct CustomDialogExample { controller: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample({}) }); // 懒加载开关 @StorageLink('lazy_for_each') lazyForEach: boolean | undefined = AppStorage.get('lazy_for_each'); // 组件复用开关 @StorageLink('reusable') reusable: boolean | undefined = AppStorage.get('reusable'); // 同步加载开关 @StorageLink('image_sync_load') imageSyncLoad: boolean | undefined = AppStorage.get('image_sync_load'); // 布局优化开关 @StorageLink('page_layout') pageLayout: boolean | undefined = AppStorage.get('page_layout'); // 缓存数量开关 @StorageLink('list_cached_count') listCachedCount: boolean | undefined = AppStorage.get('list_cached_count'); private promptArr: PromptType[] = [ new PromptType($r('app.media.pic1'),$r('app.string.add_friends')), new PromptType($r('app.media.pic2'),$r('app.string.group_chat')), new PromptType($r('app.media.pic3'),$r('app.string.scan')), new PromptType($r('app.media.pic4'),$r('app.string.collection_payment')) ]; build() { Column() { // 首页右上角点击加号按钮弹出的列表框的前4个item List({ space: SPACE, initialIndex: INITIAL_INDEX }) { ForEach(this.promptArr, (item: PromptType) => { ListItem() { Prompt({ image: item.image, text: item.text, controller: this.controller }) } }, (item: PromptType) => JSON.stringify(item)) } .friction($r("app.float.customDialog_list_friction")) .listDirection(Axis.Vertical) // 排列方向 // 每行之间的分界线 .divider({ strokeWidth:DIVIDER_LINE_STROKWIDTH, color: $r("app.color.customDialog_list_divider_color"), startMargin: $r("app.integer.customDialog_divider_startMargin"), endMargin: $r("app.integer.customDialog_divider_endMargin") }) // 分隔线组件 Divider() .strokeWidth(DIVIDER_LINE_STROKWIDTH) .color($r("app.color.customDialog_list_divider_color")) .margin({ left: $r("app.integer.customDialog_divider_startMargin"), right: $r('app.integer.customDialog_divider_endMargin') }) // 懒加载开关 ToggleComponent({ text_option: $r('app.string.prop_lazy_for_each'), isOn: $lazyForEach }) diaLogDivider() // 组件复用开关 ToggleComponent({ text_option: $r('app.string.prop_reusable'), isOn: $reusable }) diaLogDivider() // 同步加载开关 ToggleComponent({ text_option: $r('app.string.prop_syncLoad'), isOn: $imageSyncLoad }) diaLogDivider() // 布局优化开关 ToggleComponent({ text_option: $r('app.string.prop_layout'), isOn: $pageLayout }) diaLogDivider() // 缓存数量开关 ToggleComponent({ text_option: $r('app.string.prop_cachedCount'), isOn: $listCachedCount }) } .backgroundColor($r("app.color.customDialog_list_backgroundColor")) .borderRadius($r("app.integer.customDialog_list_borderRadius")) .padding({ top: $r("app.integer.customDialog_list_padding_top"), bottom: $r("app.integer.customDialog_list_padding_bottom") }) .width($r("app.integer.customDialog_list_width")) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CustomDialogExample AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController 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 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 CustomDialogExample AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { } AST#object_literal#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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 懒加载开关 AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'lazy_for_each' AST#expression#Right ) AST#decorator#Right lazyForEach : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'lazy_for_each' 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 @ StorageLink ( AST#expression#Left 'reusable' AST#expression#Right ) AST#decorator#Right reusable : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'reusable' 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 @ StorageLink ( AST#expression#Left 'image_sync_load' AST#expression#Right ) AST#decorator#Right imageSyncLoad : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'image_sync_load' 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 @ StorageLink ( AST#expression#Left 'page_layout' AST#expression#Right ) AST#decorator#Right pageLayout : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'page_layout' 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 @ StorageLink ( AST#expression#Left 'list_cached_count' AST#expression#Right ) AST#decorator#Right listCachedCount : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'list_cached_count' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private promptArr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PromptType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PromptType AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.pic1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.add_friends' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PromptType AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.pic2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.group_chat' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PromptType AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.pic3' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.scan' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PromptType AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.pic4' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.collection_payment' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right 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 Column ( ) AST#container_content_body#Left { // 首页右上角点击加号按钮弹出的列表框的前4个item 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 SPACE AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left initialIndex : AST#expression#Left INITIAL_INDEX 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 . promptArr 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 PromptType 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 Prompt ( AST#component_parameters#Left { AST#component_parameter#Left image : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . image AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right 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#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 PromptType 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 JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) 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 . friction ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.customDialog_list_friction" AST#expression#Right ) AST#resource_expression#Right 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 . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left DIVIDER_LINE_STROKWIDTH AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.customDialog_list_divider_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left startMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.customDialog_divider_startMargin" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.customDialog_divider_endMargin" 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#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 Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left DIVIDER_LINE_STROKWIDTH AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.customDialog_list_divider_color" 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 left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.customDialog_divider_startMargin" 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.integer.customDialog_divider_endMargin' 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#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 ToggleComponent ( AST#component_parameters#Left { AST#component_parameter#Left text_option : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.prop_lazy_for_each' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left $lazyForEach 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left diaLogDivider ( ) 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 ToggleComponent ( AST#component_parameters#Left { AST#component_parameter#Left text_option : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.prop_reusable' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left $reusable 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left diaLogDivider ( ) 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 ToggleComponent ( AST#component_parameters#Left { AST#component_parameter#Left text_option : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.prop_syncLoad' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left $imageSyncLoad 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left diaLogDivider ( ) 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 ToggleComponent ( AST#component_parameters#Left { AST#component_parameter#Left text_option : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.prop_layout' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left $pageLayout 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left diaLogDivider ( ) 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 ToggleComponent ( AST#component_parameters#Left { AST#component_parameter#Left text_option : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.prop_cachedCount' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left $listCachedCount 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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.customDialog_list_backgroundColor" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.customDialog_list_borderRadius" 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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.customDialog_list_padding_top" 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.customDialog_list_padding_bottom" 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 . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.customDialog_list_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#component_body#Right AST#decorated_export_declaration#Right
@CustomDialog export struct CustomDialogExample { controller: CustomDialogController = new CustomDialogController({ builder: CustomDialogExample({}) }); @StorageLink('lazy_for_each') lazyForEach: boolean | undefined = AppStorage.get('lazy_for_each'); @StorageLink('reusable') reusable: boolean | undefined = AppStorage.get('reusable'); @StorageLink('image_sync_load') imageSyncLoad: boolean | undefined = AppStorage.get('image_sync_load'); @StorageLink('page_layout') pageLayout: boolean | undefined = AppStorage.get('page_layout'); @StorageLink('list_cached_count') listCachedCount: boolean | undefined = AppStorage.get('list_cached_count'); private promptArr: PromptType[] = [ new PromptType($r('app.media.pic1'),$r('app.string.add_friends')), new PromptType($r('app.media.pic2'),$r('app.string.group_chat')), new PromptType($r('app.media.pic3'),$r('app.string.scan')), new PromptType($r('app.media.pic4'),$r('app.string.collection_payment')) ]; build() { Column() { List({ space: SPACE, initialIndex: INITIAL_INDEX }) { ForEach(this.promptArr, (item: PromptType) => { ListItem() { Prompt({ image: item.image, text: item.text, controller: this.controller }) } }, (item: PromptType) => JSON.stringify(item)) } .friction($r("app.float.customDialog_list_friction")) .listDirection(Axis.Vertical) .divider({ strokeWidth:DIVIDER_LINE_STROKWIDTH, color: $r("app.color.customDialog_list_divider_color"), startMargin: $r("app.integer.customDialog_divider_startMargin"), endMargin: $r("app.integer.customDialog_divider_endMargin") }) Divider() .strokeWidth(DIVIDER_LINE_STROKWIDTH) .color($r("app.color.customDialog_list_divider_color")) .margin({ left: $r("app.integer.customDialog_divider_startMargin"), right: $r('app.integer.customDialog_divider_endMargin') }) ToggleComponent({ text_option: $r('app.string.prop_lazy_for_each'), isOn: $lazyForEach }) diaLogDivider() ToggleComponent({ text_option: $r('app.string.prop_reusable'), isOn: $reusable }) diaLogDivider() ToggleComponent({ text_option: $r('app.string.prop_syncLoad'), isOn: $imageSyncLoad }) diaLogDivider() ToggleComponent({ text_option: $r('app.string.prop_layout'), isOn: $pageLayout }) diaLogDivider() ToggleComponent({ text_option: $r('app.string.prop_cachedCount'), isOn: $listCachedCount }) } .backgroundColor($r("app.color.customDialog_list_backgroundColor")) .borderRadius($r("app.integer.customDialog_list_borderRadius")) .padding({ top: $r("app.integer.customDialog_list_padding_top"), bottom: $r("app.integer.customDialog_list_padding_bottom") }) .width($r("app.integer.customDialog_list_width")) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/view/CustomDialogExample.ets#L43-L114
57c03729c9bb9db6ab831c958522f416db88b5a4
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
initDatabase
MARK: - 私有方法 初始化数据库连接 @returns Promise<boolean> 返回是否初始化成功 注意:该方法会自动处理连接关闭,调用方无需关心资源释放
private async initDatabase(): Promise<boolean> { // 已初始化则直接返回 if (this.isInitialized) return true; // 检查数据库路径有效性 if (!this.dbPath) { console.error("DBAccessor: 数据库路径不能为空"); return false; } const relativePath = PathUtility.getRelativeDatabasePath(this.dbPath!) const dbFolder = PathUtility.getParentPathOf(relativePath) const dbFolderPath = PathUtility.removeLastSlashOfDirectoryIfExists(dbFolder) const dbName = PathUtility.getLastComponentName(this.dbPath!) // 数据库配置 const STORE_CONFIG: relationalStore.StoreConfig = { name: dbName, customDir: dbFolderPath!,///相对于../rdb/后的部分 isReadOnly: this.isReadOnly, //只读 securityLevel: relationalStore.SecurityLevel.S2 // S1级安全加密 }; try { // 创建数据库连接 this.rdbStore = await relationalStore.getRdbStore(getAppContext(), STORE_CONFIG); // 附加其他数据库 if (this.attachPaths) { for (const path of this.attachPaths) { if (path) await this.attachDatabase(path); } } this.isInitialized = true; return true; } catch (err) { console.error(`DBAccessor: 数据库初始化失败 - ${err}`); this.closeDatabase(); // 初始化失败时关闭连接 return false; } }
AST#method_declaration#Left private async initDatabase 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . dbPath 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "DBAccessor: 数据库路径不能为空" 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#boolean_literal#Left false AST#boolean_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 relativePath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PathUtility AST#expression#Right . getRelativeDatabasePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dbPath AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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 dbFolder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PathUtility AST#expression#Right . getParentPathOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left relativePath 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 dbFolderPath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PathUtility AST#expression#Right . removeLastSlashOfDirectoryIfExists AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dbFolder 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 dbName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PathUtility AST#expression#Right . getLastComponentName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dbPath AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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 STORE_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 dbName AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customDir AST#property_name#Right : AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left dbFolderPath AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#property_assignment#Right , ///相对于../rdb/后的部分 AST#property_assignment#Left AST#property_name#Left isReadOnly AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isReadOnly 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 . S2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right // S1级安全加密 } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#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#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 AST#call_expression#Left AST#expression#Left getAppContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left STORE_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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . attachPaths AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const path of AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . attachPaths AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left path AST#expression#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 . attachDatabase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_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 . isInitialized 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#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` DBAccessor: 数据库初始化失败 - 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . closeDatabase 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#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_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
private async initDatabase(): Promise<boolean> { if (this.isInitialized) return true; if (!this.dbPath) { console.error("DBAccessor: 数据库路径不能为空"); return false; } const relativePath = PathUtility.getRelativeDatabasePath(this.dbPath!) const dbFolder = PathUtility.getParentPathOf(relativePath) const dbFolderPath = PathUtility.removeLastSlashOfDirectoryIfExists(dbFolder) const dbName = PathUtility.getLastComponentName(this.dbPath!) const STORE_CONFIG: relationalStore.StoreConfig = { name: dbName, customDir: dbFolderPath!, isReadOnly: this.isReadOnly, securityLevel: relationalStore.SecurityLevel.S2 }; try { this.rdbStore = await relationalStore.getRdbStore(getAppContext(), STORE_CONFIG); if (this.attachPaths) { for (const path of this.attachPaths) { if (path) await this.attachDatabase(path); } } this.isInitialized = true; return true; } catch (err) { console.error(`DBAccessor: 数据库初始化失败 - ${err}`); this.closeDatabase(); return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L61-L102
da70359ab245547302f12e720ccea08b2fc5ae94
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageflip/src/main/ets/view/CoverFlipPage.ets
arkts
CoverFlipPage
1.在`Stack`组件中布局三个`ReaderPage`,`midPage`位于中间可以根据this.offsetX实时translate自己的位置。 当this.offsetX<0时,translate的x为this.offsetX,midPage向左移动,显现`rightPage`。 当this.offsetX>0,translate的x为0,midPage不动,`leftPage`向右滑动。 2.将滑动翻页的动画和点击翻页的动画封装在一个闭包中,由`isClick`来判断是点击翻页还是滑动翻页, 由`isLeft`来判断点击翻页中是向左翻页还是向右翻页。确定翻页时将this.offsetX设置为this.screenW 或者-this.screenW。translate移动加上动画效果就会产生覆盖翻页的效果。 3.当动画结束时由于翻页会让`this.currentPageNum`加一或减一,根据相应的页数来加载三个`content`相应的内容。
@Component export struct CoverFlipPage { @State leftPageContent: string = ""; @State midPageContent: string = ""; @State rightPageContent: string = ""; @State offsetX: number = 0; @Link isMenuViewVisible: boolean; @Link isCommentVisible: boolean; @Link @Watch('updatePage')currentPageNum: number; private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Left | PanDirection.Right }); private screenW: number = px2vp(display.getDefaultDisplaySync().width); @Prop bgColor: string; @Prop isbgImage: boolean; @Prop textSize: number; // 播放文章列表 @Link readInfoList: TextReader.ReadInfo[]; @Link selectedReadInfo: TextReader.ReadInfo; aboutToAppear() { /** * 请求网络数据之后可以通过this.data.addItem(new Item('app.string.content' + i.toString()));的方法插入到数据源的开头形成新的数据源。 * 请求网络数据之后可以通过this.data.pushItem(new Item('app.string.content' + i.toString()));的方法插入到数据源的末尾形成新的数据源。 */ this.simulatePageContent(); if (this.screenW > CONFIGURATION.WINDOWWIDTH) { this.screenW = this.screenW / 2; } } updatePage() { if(!this.offsetX) { this.clickAnimateTo(false); } } // 模拟书页内容,可以在此进行网络请求。 simulatePageContent() { this.leftPageContent = STRINGCONFIGURATION.PAGEFLIPRESOURCE + (this.currentPageNum - CONFIGURATION.PAGEFLIPPAGECOUNT).toString(); this.midPageContent = STRINGCONFIGURATION.PAGEFLIPRESOURCE + (this.currentPageNum).toString(); this.rightPageContent = STRINGCONFIGURATION.PAGEFLIPRESOURCE + (this.currentPageNum + CONFIGURATION.PAGEFLIPPAGECOUNT).toString(); } private clickAnimateTo(isClick: boolean, isLeft?: boolean) { animateTo({ duration: CONFIGURATION.PAGEFLIPTOASTDURATION, curve: Curve.EaseOut, onFinish: () => { /** TODO: 知识点:this.currentPageNum加一或者减一后修改组件的内容。 * 右滑:1. 恢复页面原始状态 2. 修改组件的内容为 page1 = content1-1, page2 = content2-1,page3 = content3-1 * 左滑:1. 恢复页面原始状态 2. 修改组件的内容为 page1 = content1+1, page2 = content2+1,page3 = content3+1 */ if (this.offsetX > CONFIGURATION.PAGEFLIPRIGHTFLIPOFFSETX && this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGESTART) { this.currentPageNum -= CONFIGURATION.PAGEFLIPPAGECOUNT; } else if (this.offsetX < CONFIGURATION.PAGEFLIPLEFTFLIPOFFSETX && this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGEEND) { this.currentPageNum += CONFIGURATION.PAGEFLIPPAGECOUNT; } this.offsetX = CONFIGURATION.PAGEFLIPZERO; this.simulatePageContent(); this.selectedReadInfo = this.readInfoList[this.currentPageNum - CONFIGURATION.PAGEFLIPPAGECOUNT]; } }, () => { if (isClick) { // 是否为点击翻页 if (isLeft) { this.offsetX = this.screenW; // TODO: 知识点:右滑距离变为一个屏幕宽度,ReaderPage就会向右移动一个屏幕宽度,加上动画,形成了覆盖翻页的效果。 } else { this.offsetX = -this.screenW; // TODO: 知识点:左滑距离变为一个屏幕宽度,ReaderPage就会向左移动一个屏幕宽度,加上动画,形成了覆盖翻页的效果。 } } else { // 滑动翻页 if (this.offsetX > CONFIGURATION.PAGEFLIPRIGHTFLIPOFFSETX && this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGESTART) { this.offsetX = this.screenW; } else if (this.offsetX < CONFIGURATION.PAGEFLIPLEFTFLIPOFFSETX && this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGEEND) { this.offsetX = -this.screenW; } else { this.offsetX = CONFIGURATION.PAGEFLIPZERO; // 当位于第一页和末尾页,移动距离设为0,无法翻页。 } } }); } build() { Stack() { ReaderPage({ content: this.rightPageContent, bgColor: this.bgColor, isbgImage: this.isbgImage, textSize: this.textSize, currentPageNum: this.currentPageNum }); // 当midPage向左滑时,rightPage开始显现。 ReaderPage({ content: this.midPageContent, bgColor: this.bgColor, isbgImage: this.isbgImage, textSize: this.textSize, currentPageNum: this.currentPageNum }) /** TODO: 知识点: * 当this.offsetX<0时,translate的x为this.offsetX,midPage向左移动,显现rightPage。 * 当this.offsetX>0,translate的x为CONFIGURATION.PAGEFLIPZERO,midPage不动,leftPage向右滑动。 */ .translate({ x: this.offsetX >= CONFIGURATION.PAGEFLIPZERO ? CONFIGURATION.PAGEFLIPZERO : this.offsetX, y: CONFIGURATION.PAGEFLIPZERO, z: CONFIGURATION.PAGEFLIPZERO }) .width(this.screenW); ReaderPage({ content: this.leftPageContent, bgColor: this.bgColor, isbgImage: this.isbgImage, textSize: this.textSize, currentPageNum: this.currentPageNum }) // TODO: 知识点:在midPage的左边,当向右滑时,跟随this.offsetX向右滑动。 .translate({ x: -this.screenW + this.offsetX }); } .gesture( PanGesture(this.panOption) // TODO: 性能知识点: 该函数是系统高频回调函数,避免在函数中进行冗余或耗时操作,例如应该减少或避免在函数打印日志,会有较大的性能损耗。 .onActionUpdate((event?: GestureEvent) => { if (!event) { return; } this.offsetX = event.offsetX; }) .onActionEnd(() => { this.clickAnimateTo(false); }) ) .onClick((event?: ClickEvent) => { if (event) { if (event.x > this.screenW / CONFIGURATION.PAGEFLIPTHREE * CONFIGURATION.PAGEFLIPTWO) { // 点击屏幕左侧1/3,页面向左翻页;点击中间区域,弹出菜单;点击屏幕右侧1/3,页面向右翻页。 if (this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGEEND) { this.clickAnimateTo(true, false); } } else if (event.x > this.screenW / CONFIGURATION.PAGEFLIPTHREE) { if (this.isMenuViewVisible) { this.isMenuViewVisible = false; this.isCommentVisible = false; } else { this.isMenuViewVisible = true; this.isCommentVisible = true; } } else { // 向左翻页 if (this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGESTART) { this.clickAnimateTo(true, true); } } } }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CoverFlipPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right leftPageContent : 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 AST#decorator#Left @ State AST#decorator#Right midPageContent : 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 AST#decorator#Left @ State AST#decorator#Right rightPageContent : 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 AST#decorator#Left @ State AST#decorator#Right offsetX : 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 @ Link AST#decorator#Right isMenuViewVisible : 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 @ Link AST#decorator#Right isCommentVisible : 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 @ Link AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updatePage' AST#expression#Right ) AST#decorator#Right currentPageNum : 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 private panOption : AST#type_annotation#Left AST#primary_type#Left PanGestureOptions 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 PanGestureOptions 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 direction AST#property_name#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 PanDirection AST#expression#Right . Left AST#member_expression#Right AST#expression#Right | AST#expression#Left PanDirection AST#expression#Right AST#binary_expression#Right AST#expression#Right . Right 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#property_declaration#Right AST#property_declaration#Left private screenW : 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 px2vp AST#expression#Right AST#argument_list#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 display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right 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 @ Prop AST#decorator#Right bgColor : 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 @ Prop AST#decorator#Right isbgImage : 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 @ Prop AST#decorator#Right textSize : 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 AST#decorator#Left @ Link AST#decorator#Right readInfoList : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left [ ] AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right selectedReadInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { /** * 请求网络数据之后可以通过this.data.addItem(new Item('app.string.content' + i.toString()));的方法插入到数据源的开头形成新的数据源。 * 请求网络数据之后可以通过this.data.pushItem(new Item('app.string.content' + i.toString()));的方法插入到数据源的末尾形成新的数据源。 */ 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 . simulatePageContent 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_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 this AST#expression#Right . screenW AST#member_expression#Right AST#expression#Right > AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . WINDOWWIDTH 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 this AST#expression#Right . screenW AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenW AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_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 AST#method_declaration#Left updatePage 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . offsetX 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 . clickAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_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 // 模拟书页内容,可以在此进行网络请求。 AST#method_declaration#Left simulatePageContent 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 . leftPageContent AST#member_expression#Right = 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#member_expression#Left AST#expression#Left STRINGCONFIGURATION AST#expression#Right . PAGEFLIPRESOURCE AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_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 . currentPageNum AST#member_expression#Right AST#expression#Right - AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGECOUNT AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_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#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 . midPageContent AST#member_expression#Right = 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#member_expression#Left AST#expression#Left STRINGCONFIGURATION AST#expression#Right . PAGEFLIPRESOURCE AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_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#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 . rightPageContent AST#member_expression#Right = 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#member_expression#Left AST#expression#Left STRINGCONFIGURATION AST#expression#Right . PAGEFLIPRESOURCE AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_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 . currentPageNum AST#member_expression#Right AST#expression#Right + AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGECOUNT AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left private clickAnimateTo AST#parameter_list#Left ( AST#parameter#Left isClick : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeft ? : 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PAGEFLIPTOASTDURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left curve : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseOut AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onFinish : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { /** TODO: 知识点:this.currentPageNum加一或者减一后修改组件的内容。 * 右滑:1. 恢复页面原始状态 2. 修改组件的内容为 page1 = content1-1, page2 = content2-1,page3 = content3-1 * 左滑:1. 恢复页面原始状态 2. 修改组件的内容为 page1 = content1+1, page2 = content2+1,page3 = content3+1 */ 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right > AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPRIGHTFLIPOFFSETX AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right !== AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGESTART AST#member_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 . currentPageNum AST#member_expression#Right -= AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PAGEFLIPPAGECOUNT 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#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right < AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPLEFTFLIPOFFSETX AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right !== AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGEEND AST#member_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 . currentPageNum AST#member_expression#Right += AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PAGEFLIPPAGECOUNT 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#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 . offsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PAGEFLIPZERO 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 . simulatePageContent 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedReadInfo AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readInfoList AST#member_expression#Right AST#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 this AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right - AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGECOUNT 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 AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right AST#ERROR#Left , ( AST#ERROR#Right ) AST#ERROR#Left => AST#ERROR#Right AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left isClick AST#expression#Right ) { // 是否为点击翻页 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left isLeft 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 . offsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenW AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // TODO: 知识点:右滑距离变为一个屏幕宽度,ReaderPage就会向右移动一个屏幕宽度,加上动画,形成了覆盖翻页的效果。 } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX 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 . screenW AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // TODO: 知识点:左滑距离变为一个屏幕宽度,ReaderPage就会向左移动一个屏幕宽度,加上动画,形成了覆盖翻页的效果。 } AST#ui_if_statement#Right AST#ui_control_flow#Right } else { // 滑动翻页 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#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 this AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right > AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPRIGHTFLIPOFFSETX AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right !== AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGESTART 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 this AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenW AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else 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#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 this AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right < AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPLEFTFLIPOFFSETX AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right !== AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGEEND 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 this AST#expression#Right . offsetX 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 . screenW AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PAGEFLIPZERO AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 当位于第一页和末尾页,移动距离设为0,无法翻页。 } AST#ui_if_statement#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#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 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left ReaderPage ( AST#component_parameters#Left { AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rightPageContent AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isbgImage : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isbgImage AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left textSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left currentPageNum : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right // 当midPage向左滑时,rightPage开始显现。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ReaderPage ( AST#component_parameters#Left { AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . midPageContent AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isbgImage : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isbgImage AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left textSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left currentPageNum : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right /** TODO: 知识点: * 当this.offsetX<0时,translate的x为this.offsetX,midPage向左移动,显现rightPage。 * 当this.offsetX>0,translate的x为CONFIGURATION.PAGEFLIPZERO,midPage不动,leftPage向右滑动。 */ AST#modifier_chain_expression#Left . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right >= AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPZERO AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PAGEFLIPZERO AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PAGEFLIPZERO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . PAGEFLIPZERO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenW 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#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ReaderPage ( AST#component_parameters#Left { AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . leftPageContent AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isbgImage : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isbgImage AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left textSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left currentPageNum : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentPageNum AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right // TODO: 知识点:在midPage的左边,当向右滑时,跟随this.offsetX向右滑动。 AST#modifier_chain_expression#Left . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#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 AST#unary_expression#Left - AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . screenW AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetX 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#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . gesture ( 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 PanGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . panOption AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right // TODO: 性能知识点: 该函数是系统高频回调函数,避免在函数中进行冗余或耗时操作,例如应该减少或避免在函数打印日志,会有较大的性能损耗。 . onActionUpdate 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 event ? : AST#type_annotation#Left AST#primary_type#Left GestureEvent 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 event 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 . offsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetX 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionEnd AST#member_expression#Right 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clickAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left ClickEvent 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 event AST#expression#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 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 event AST#expression#Right . x AST#member_expression#Right AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . screenW AST#member_expression#Right AST#expression#Right / AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPTHREE AST#member_expression#Right AST#expression#Right * AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPTWO AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 点击屏幕左侧1/3,页面向左翻页;点击中间区域,弹出菜单;点击屏幕右侧1/3,页面向右翻页。 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 . currentPageNum AST#member_expression#Right AST#expression#Right !== AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGEEND 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 . clickAnimateTo 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#expression#Left AST#boolean_literal#Left false 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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else 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 event AST#expression#Right . x AST#member_expression#Right AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . screenW AST#member_expression#Right AST#expression#Right / AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPTHREE AST#member_expression#Right AST#expression#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 . isMenuViewVisible AST#member_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 . isMenuViewVisible 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#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 . isCommentVisible 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#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 . isMenuViewVisible 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCommentVisible 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#if_statement#Right AST#statement#Right } AST#block_statement#Right else 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 . currentPageNum AST#member_expression#Right AST#expression#Right !== AST#expression#Left CONFIGURATION AST#expression#Right AST#binary_expression#Right AST#expression#Right . PAGEFLIPPAGESTART 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 . clickAnimateTo 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#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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct CoverFlipPage { @State leftPageContent: string = ""; @State midPageContent: string = ""; @State rightPageContent: string = ""; @State offsetX: number = 0; @Link isMenuViewVisible: boolean; @Link isCommentVisible: boolean; @Link @Watch('updatePage')currentPageNum: number; private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Left | PanDirection.Right }); private screenW: number = px2vp(display.getDefaultDisplaySync().width); @Prop bgColor: string; @Prop isbgImage: boolean; @Prop textSize: number; @Link readInfoList: TextReader.ReadInfo[]; @Link selectedReadInfo: TextReader.ReadInfo; aboutToAppear() { this.simulatePageContent(); if (this.screenW > CONFIGURATION.WINDOWWIDTH) { this.screenW = this.screenW / 2; } } updatePage() { if(!this.offsetX) { this.clickAnimateTo(false); } } simulatePageContent() { this.leftPageContent = STRINGCONFIGURATION.PAGEFLIPRESOURCE + (this.currentPageNum - CONFIGURATION.PAGEFLIPPAGECOUNT).toString(); this.midPageContent = STRINGCONFIGURATION.PAGEFLIPRESOURCE + (this.currentPageNum).toString(); this.rightPageContent = STRINGCONFIGURATION.PAGEFLIPRESOURCE + (this.currentPageNum + CONFIGURATION.PAGEFLIPPAGECOUNT).toString(); } private clickAnimateTo(isClick: boolean, isLeft?: boolean) { animateTo({ duration: CONFIGURATION.PAGEFLIPTOASTDURATION, curve: Curve.EaseOut, onFinish: () => { if (this.offsetX > CONFIGURATION.PAGEFLIPRIGHTFLIPOFFSETX && this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGESTART) { this.currentPageNum -= CONFIGURATION.PAGEFLIPPAGECOUNT; } else if (this.offsetX < CONFIGURATION.PAGEFLIPLEFTFLIPOFFSETX && this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGEEND) { this.currentPageNum += CONFIGURATION.PAGEFLIPPAGECOUNT; } this.offsetX = CONFIGURATION.PAGEFLIPZERO; this.simulatePageContent(); this.selectedReadInfo = this.readInfoList[this.currentPageNum - CONFIGURATION.PAGEFLIPPAGECOUNT]; } }, () => { if (isClick) { if (isLeft) { this.offsetX = this.screenW; } else { this.offsetX = -this.screenW; } } else { if (this.offsetX > CONFIGURATION.PAGEFLIPRIGHTFLIPOFFSETX && this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGESTART) { this.offsetX = this.screenW; } else if (this.offsetX < CONFIGURATION.PAGEFLIPLEFTFLIPOFFSETX && this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGEEND) { this.offsetX = -this.screenW; } else { this.offsetX = CONFIGURATION.PAGEFLIPZERO; } } }); } build() { Stack() { ReaderPage({ content: this.rightPageContent, bgColor: this.bgColor, isbgImage: this.isbgImage, textSize: this.textSize, currentPageNum: this.currentPageNum }); ReaderPage({ content: this.midPageContent, bgColor: this.bgColor, isbgImage: this.isbgImage, textSize: this.textSize, currentPageNum: this.currentPageNum }) .translate({ x: this.offsetX >= CONFIGURATION.PAGEFLIPZERO ? CONFIGURATION.PAGEFLIPZERO : this.offsetX, y: CONFIGURATION.PAGEFLIPZERO, z: CONFIGURATION.PAGEFLIPZERO }) .width(this.screenW); ReaderPage({ content: this.leftPageContent, bgColor: this.bgColor, isbgImage: this.isbgImage, textSize: this.textSize, currentPageNum: this.currentPageNum }) .translate({ x: -this.screenW + this.offsetX }); } .gesture( PanGesture(this.panOption) .onActionUpdate((event?: GestureEvent) => { if (!event) { return; } this.offsetX = event.offsetX; }) .onActionEnd(() => { this.clickAnimateTo(false); }) ) .onClick((event?: ClickEvent) => { if (event) { if (event.x > this.screenW / CONFIGURATION.PAGEFLIPTHREE * CONFIGURATION.PAGEFLIPTWO) { if (this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGEEND) { this.clickAnimateTo(true, false); } } else if (event.x > this.screenW / CONFIGURATION.PAGEFLIPTHREE) { if (this.isMenuViewVisible) { this.isMenuViewVisible = false; this.isCommentVisible = false; } else { this.isMenuViewVisible = true; this.isCommentVisible = true; } } else { if (this.currentPageNum !== CONFIGURATION.PAGEFLIPPAGESTART) { this.clickAnimateTo(true, true); } } } }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/view/CoverFlipPage.ets#L31-L184
fc8e5094838da8c09ddc5ea4b0caf6ae7ff079d0
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.uiExtensionHost.d.ets
arkts
Properties of UIExtension window @interface UIExtensionHostWindowProxyProperties @syscap SystemCapability.ArkUI.ArkUI.Full @systemapi @since 11
export interface UIExtensionHostWindowProxyProperties { /** * The position and size of the UIExtension window * * @type { window.Rect } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi * @since 11 */ uiExtensionHostWindowProxyRect: window.Rect; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UIExtensionHostWindowProxyProperties AST#object_type#Left { /** * The position and size of the UIExtension window * * @type { window.Rect } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi * @since 11 */ AST#type_member#Left uiExtensionHostWindowProxyRect : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Rect AST#qualified_type#Right 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 UIExtensionHostWindowProxyProperties { uiExtensionHostWindowProxyRect: window.Rect; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.uiExtensionHost.d.ets#L277-L287
615dab309115452eec388931ffb4374d42584687
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/constant/AlarmClockConstants.ets
arkts
闹钟页面常量描述。
export class AlarmClockConstants { /** * 闹钟页面时间列表。 */ static readonly TIMES: number[] = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2]; /** * 默认的单个数字最大值。 */ static readonly DEFAULT_SINGLE_DIGIT_MAX: number = 9; /** * 默认的水平角度。 */ static readonly DEFAULT_HORIZONTAL_ANGLE: number = 180; /** * 默认的一秒毫秒数。 */ static readonly DEFAULT_ONE_SECOND_MS: number = 1000; /** * 默认的零字符串。 */ static readonly DEFAULT_ZEROING: string = '0'; /** * 默认的闹钟名称字符串。 */ static readonly DEFAULT_STRING_ALARM: string = '闹钟'; /** * 默认的空字符串引号。 */ static readonly DEFAULT_STRING_NULL: string = ''; /** * 默认的冒号字符串。 */ static readonly DEFAULT_STRING_COLON: string = ':'; /** * 默认的时钟时间字体大小单位。 */ static readonly CLOCK_TIME_FONT_SIZE_UNIT: string = 'px'; /** * 小时指针图片的URL。 */ static readonly HOUR_POINTER_IMAGE_URL: string = '../../../resources/base/media/ic_hour_pointer.png'; /** * 分钟指针图片的URL。 */ static readonly MINUTE_POINTER_IMAGE_URL: string = '../../../resources/base/media/ic_minute_pointer.png'; /** * 秒钟指针图片的URL。 */ static readonly SECOND_POINTER_IMAGE_URL: string = '../../../resources/base/media/ic_second_pointer.png'; /** * 时钟盘图片的URL。 */ static readonly CLOCK_PAN_IMAGE_URL: string = '../../../resources/base/media/ic_clock_pan.png'; /** * 重复类型分组。 */ static readonly REPEAT_TYPE_GROUP: string = 'repeatTypeGroup'; }
AST#export_declaration#Left export AST#class_declaration#Left class AlarmClockConstants AST#class_body#Left { /** * 闹钟页面时间列表。 */ AST#property_declaration#Left static readonly TIMES : 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 3 AST#expression#Right , AST#expression#Left 4 AST#expression#Right , AST#expression#Left 5 AST#expression#Right , AST#expression#Left 6 AST#expression#Right , AST#expression#Left 7 AST#expression#Right , AST#expression#Left 8 AST#expression#Right , AST#expression#Left 9 AST#expression#Right , AST#expression#Left 10 AST#expression#Right , AST#expression#Left 11 AST#expression#Right , AST#expression#Left 12 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 默认的单个数字最大值。 */ AST#property_declaration#Left static readonly DEFAULT_SINGLE_DIGIT_MAX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 9 AST#expression#Right ; AST#property_declaration#Right /** * 默认的水平角度。 */ AST#property_declaration#Left static readonly DEFAULT_HORIZONTAL_ANGLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 180 AST#expression#Right ; AST#property_declaration#Right /** * 默认的一秒毫秒数。 */ AST#property_declaration#Left static readonly DEFAULT_ONE_SECOND_MS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1000 AST#expression#Right ; AST#property_declaration#Right /** * 默认的零字符串。 */ AST#property_declaration#Left static readonly DEFAULT_ZEROING : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '0' AST#expression#Right ; AST#property_declaration#Right /** * 默认的闹钟名称字符串。 */ AST#property_declaration#Left static readonly DEFAULT_STRING_ALARM : 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 static readonly DEFAULT_STRING_NULL : 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 static readonly DEFAULT_STRING_COLON : 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 static readonly CLOCK_TIME_FONT_SIZE_UNIT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'px' AST#expression#Right ; AST#property_declaration#Right /** * 小时指针图片的URL。 */ AST#property_declaration#Left static readonly HOUR_POINTER_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_hour_pointer.png' AST#expression#Right ; AST#property_declaration#Right /** * 分钟指针图片的URL。 */ AST#property_declaration#Left static readonly MINUTE_POINTER_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_minute_pointer.png' AST#expression#Right ; AST#property_declaration#Right /** * 秒钟指针图片的URL。 */ AST#property_declaration#Left static readonly SECOND_POINTER_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_second_pointer.png' AST#expression#Right ; AST#property_declaration#Right /** * 时钟盘图片的URL。 */ AST#property_declaration#Left static readonly CLOCK_PAN_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_clock_pan.png' AST#expression#Right ; AST#property_declaration#Right /** * 重复类型分组。 */ AST#property_declaration#Left static readonly REPEAT_TYPE_GROUP : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'repeatTypeGroup' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class AlarmClockConstants { static readonly TIMES: number[] = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2]; static readonly DEFAULT_SINGLE_DIGIT_MAX: number = 9; static readonly DEFAULT_HORIZONTAL_ANGLE: number = 180; static readonly DEFAULT_ONE_SECOND_MS: number = 1000; static readonly DEFAULT_ZEROING: string = '0'; static readonly DEFAULT_STRING_ALARM: string = '闹钟'; static readonly DEFAULT_STRING_NULL: string = ''; static readonly DEFAULT_STRING_COLON: string = ':'; static readonly CLOCK_TIME_FONT_SIZE_UNIT: string = 'px'; static readonly HOUR_POINTER_IMAGE_URL: string = '../../../resources/base/media/ic_hour_pointer.png'; static readonly MINUTE_POINTER_IMAGE_URL: string = '../../../resources/base/media/ic_minute_pointer.png'; static readonly SECOND_POINTER_IMAGE_URL: string = '../../../resources/base/media/ic_second_pointer.png'; static readonly CLOCK_PAN_IMAGE_URL: string = '../../../resources/base/media/ic_clock_pan.png'; static readonly REPEAT_TYPE_GROUP: string = 'repeatTypeGroup'; }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/constant/AlarmClockConstants.ets#L4-L61
5ad49a122adc3ba25a63877b77f781b2a44ce1d1
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/MineView.ets
arkts
StatsModule
构建统计模块
@Builder StatsModule() { Row({ space: 12 }) { // 左侧统计 Column({space:4}) { Text('已做题') .fontSize(14) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') Text(String(this.didCount)) .fontSize(24) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') .height(32) .textAlign(TextAlign.Center) Text(`正确率${this.accuracyRate}%`) .fontSize(12) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Regular) .fontColor('rgba(0,0,0,0.6)') } .width(78) .height(99) .borderRadius(8) .padding(12) .backgroundColor('rgba(0,0,0,0.05)') .justifyContent(FlexAlign.Start) .alignItems(HorizontalAlign.Center) // 右侧统计 Column({space:4}) { Text('模拟考试平均分') .fontSize(14) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') Text(String(this.averageScore)) .fontSize(24) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') .height(32) .textAlign(TextAlign.Center) Text(`累计考试 ${this.examService.mockExamCount} 次`) .fontSize(12) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Regular) .fontColor('rgba(0,0,0,0.6)') } .width(122) .height(99) .borderRadius(8) .padding(12) .backgroundColor('rgba(0,0,0,0.05)') .justifyContent(FlexAlign.Start) .alignItems(HorizontalAlign.Center) } .width('100%') .height(99) .justifyContent(FlexAlign.Start) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right StatsModule 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 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 Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 4 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 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left '鸿蒙黑体' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0,0,0,0.9)' 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 Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . didCount AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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 . fontFamily ( AST#expression#Left '鸿蒙黑体' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0,0,0,0.9)' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 32 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 ) 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 Text ( AST#expression#Left AST#template_literal#Left ` 正确率 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . accuracyRate 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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left '鸿蒙黑体' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Regular AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0,0,0,0.6)' 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 . width ( AST#expression#Left 78 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 99 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 'rgba(0,0,0,0.05)' 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 HorizontalAlign 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#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 Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 4 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 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left '鸿蒙黑体' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0,0,0,0.9)' 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 Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . averageScore AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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 . fontFamily ( AST#expression#Left '鸿蒙黑体' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0,0,0,0.9)' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 32 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 ) 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 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 this AST#expression#Right . examService AST#member_expression#Right AST#expression#Right . mockExamCount 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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontFamily ( AST#expression#Left '鸿蒙黑体' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Regular AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0,0,0,0.6)' 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 . width ( AST#expression#Left 122 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 99 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 'rgba(0,0,0,0.05)' 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 HorizontalAlign 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#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 . height ( AST#expression#Left 99 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#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 StatsModule() { Row({ space: 12 }) { Column({space:4}) { Text('已做题') .fontSize(14) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') Text(String(this.didCount)) .fontSize(24) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') .height(32) .textAlign(TextAlign.Center) Text(`正确率${this.accuracyRate}%`) .fontSize(12) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Regular) .fontColor('rgba(0,0,0,0.6)') } .width(78) .height(99) .borderRadius(8) .padding(12) .backgroundColor('rgba(0,0,0,0.05)') .justifyContent(FlexAlign.Start) .alignItems(HorizontalAlign.Center) Column({space:4}) { Text('模拟考试平均分') .fontSize(14) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') Text(String(this.averageScore)) .fontSize(24) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Medium) .fontColor('rgba(0,0,0,0.9)') .height(32) .textAlign(TextAlign.Center) Text(`累计考试 ${this.examService.mockExamCount} 次`) .fontSize(12) .fontFamily('鸿蒙黑体') .fontWeight(FontWeight.Regular) .fontColor('rgba(0,0,0,0.6)') } .width(122) .height(99) .borderRadius(8) .padding(12) .backgroundColor('rgba(0,0,0,0.05)') .justifyContent(FlexAlign.Start) .alignItems(HorizontalAlign.Center) } .width('100%') .height(99) .justifyContent(FlexAlign.Start) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/products/entry/src/main/ets/pages/mine/MineView.ets#L66-L128
7558678da857834a349da3e0a1b92a21af64121d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowFunction.ets
arkts
创建并展示弹窗 @param { api.SubWindowApi | null } SubWindowApi - SubWindowApi对象 @param { window.WindowStage | undefined } windowStage - WindowStage对象
export function showApiSubWindow(SubWindowApi: api.SubWindowApi | null, windowStage: window.WindowStage | undefined) { SubWindowApi?.initSubWindow({ windowStage: windowStage as window.WindowStage }, { sum: sumResource }); }
AST#export_declaration#Left export AST#function_declaration#Left function showApiSubWindow AST#parameter_list#Left ( AST#parameter#Left SubWindowApi : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left api . SubWindowApi AST#qualified_type#Right 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 windowStage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_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 SubWindowApi AST#expression#Right ?. initSubWindow 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 windowStage AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left windowStage AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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 sum AST#property_name#Right : AST#expression#Left sumResource 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#function_declaration#Right AST#export_declaration#Right
export function showApiSubWindow(SubWindowApi: api.SubWindowApi | null, windowStage: window.WindowStage | undefined) { SubWindowApi?.initSubWindow({ windowStage: windowStage as window.WindowStage }, { sum: sumResource }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowFunction.ets#L39-L43
a6e6771fab543fc6210fd413a159a393bd5a9a72
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/home/home.ets
arkts
aboutToAppear
****************************************Building*****************************************//
aboutToAppear(): void { this.getShowContent() }
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 . getShowContent 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.getShowContent() }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/home.ets#L290-L292
37000fed123a30ab48a716d1ffbe1ee2d5b81b89
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
getLabelCount
Returns the number of label entries the y-axis should have @return
public getLabelCount(): number { return this.mLabelCount; }
AST#method_declaration#Left public getLabelCount 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 . mLabelCount AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getLabelCount(): number { return this.mLabelCount; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L392-L394
a85ec28ee25ef750ab36c7bae9dd6cd137b7b847
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ReactionEmoji.ets
arkts
应用约束60:使用ES模块导出语法
export default ReactionEmoji;
AST#export_declaration#Left export default AST#expression#Left ReactionEmoji AST#expression#Right ; AST#export_declaration#Right
export default ReactionEmoji;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ReactionEmoji.ets#L28-L28
a2d95c3f1f8ef60fed5d9bffc917204990103afb
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets
arkts
assemblingVideoBean
Assembling the video object
async assemblingVideoBean() { VIDEO_DATA.forEach(async (item: VideoItem) => { let videoBean = await getContext().resourceManager.getRawFd(item.iSrc); let uri = videoBean; this.videoLocalList.push(new VideoItem(item.name, uri, '')); }); }
AST#method_declaration#Left async assemblingVideoBean 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 VIDEO_DATA AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VideoItem 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 videoBean = 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 AST#await_expression#Left await AST#expression#Left getContext AST#expression#Right AST#await_expression#Right 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 . getRawFd 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 . iSrc 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#variable_declaration#Left let AST#variable_declarator#Left uri = AST#expression#Left videoBean 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 . videoLocalList 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 VideoItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right , AST#expression#Left uri AST#expression#Right , AST#expression#Left '' 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#builder_function_body#Right AST#method_declaration#Right
async assemblingVideoBean() { VIDEO_DATA.forEach(async (item: VideoItem) => { let videoBean = await getContext().resourceManager.getRawFd(item.iSrc); let uri = videoBean; this.videoLocalList.push(new VideoItem(item.name, uri, '')); }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets#L41-L47
a16b55725d9ffd2f4ddda10e7ffb1770195401a8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSwiperImages
Get swiper image data. @return {Array<Resource>} swiperImages.
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.img_01'), $r('app.media.img_02'), $r('app.media.img_09'), $r('app.media.img_03') ]; return swiperImages; }
AST#method_declaration#Left getSwiperImages 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 Resource 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 swiperImages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.img_01' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.img_02' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.img_09' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.img_03' AST#expression#Right ) AST#resource_expression#Right 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#return_statement#Left return AST#expression#Left swiperImages AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.img_01'), $r('app.media.img_02'), $r('app.media.img_09'), $r('app.media.img_03') ]; return swiperImages; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/viewmodel/MainViewModel.ets#L26-L34
99e2af7d66df6d2e9b7bb08b9e349226937ef612
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/XComponentVideo.ets
arkts
release
释放AVPlayer资源
async release() { if (this.isCreate) { this.setOffCallback(); await this.avPlayer.release(); this.isCreate = false; this.isPlaying = false; } }
AST#method_declaration#Left async release 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 . isCreate 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 . setOffCallback 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#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 . avPlayer AST#member_expression#Right AST#expression#Right . release 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 . isCreate 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 . isPlaying 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
async release() { if (this.isCreate) { this.setOffCallback(); await this.avPlayer.release(); this.isCreate = false; this.isPlaying = false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/XComponentVideo.ets#L125-L132
910a2928d7764f609f42918232810dfec30a4930
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/index.ets
arkts
MessageRegistry
========== 工具模块 ========== 消息类型注册表(可选) ⚠️ 普通场景无需使用,只在以下场景需要: - 使用 google.protobuf.Any 类型 - 需要根据类型名动态创建消息
export { MessageRegistry } from './MessageRegistry'
AST#export_declaration#Left export { MessageRegistry } from './MessageRegistry' AST#export_declaration#Right
export { MessageRegistry } from './MessageRegistry'
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L69-L69
a3eec5bc9cfa97850f7eb2c715bef9efea62f5ff
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
addData
改变单个数据 @param {number} index - 索引值 @param {VideoDataType} data - 修改后的值
public addData(index: number, data: VideoDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addData 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 data : AST#type_annotation#Left AST#primary_type#Left VideoDataType 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#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 index AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left data 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 index 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 addData(index: number, data: VideoDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L164-L167
037b7740f13bc492ce14dab6b2e1129fe1dff558
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/SplashScreenSample/entry/src/main/ets/pages/SplashScreenPage.ets
arkts
onPageHide
When the SplashScreenPage is hide, clear interval.
onPageHide() { clearInterval(this.intervalID); }
AST#method_declaration#Left onPageHide AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left clearInterval ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . intervalID AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
onPageHide() { clearInterval(this.intervalID); }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/SplashScreenSample/entry/src/main/ets/pages/SplashScreenPage.ets#L54-L56
79276ed81478194c4286ffd7f663bee8ef7f2c5f
gitee
Nuist666/Alzheimer.git
c171b8e739357bfc5a3fc71c90aaea6ce5d463d1
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
video net address
export const NET: string = 'http://vjs.zencdn.net/v/oceans.mp4';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left NET : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'http://vjs.zencdn.net/v/oceans.mp4' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const NET: string = 'http://vjs.zencdn.net/v/oceans.mp4';
https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/common/constants/CommonConstants.ets#L16-L16
b98d8b71f6fab262e12848e81c45137d26bc9a9b
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/StorageUtils.ets
arkts
putBoolean
存储布尔值数据 @param key 存储键 @param value 存储值
static async putBoolean(key: string, value: boolean): Promise<void> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return; } try { await dataPreferences.put(key, value); await dataPreferences.flush(); } catch (error) { console.error(`Failed to put boolean for key ${key}:`, error); } }
AST#method_declaration#Left static async putBoolean 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 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#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 dataPreferences = AST#expression#Left AST#member_expression#Left AST#expression#Left StorageUtils AST#expression#Right . dataPreferences AST#member_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 dataPreferences AST#expression#Right AST#unary_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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Preferences not initialized' 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#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#await_expression#Left await AST#expression#Left dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value 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 dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . flush 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#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 ` Failed to put boolean for key AST#template_substitution#Left $ { AST#expression#Left key AST#expression#Right } AST#template_substitution#Right : ` AST#template_literal#Right 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#block_statement#Right AST#method_declaration#Right
static async putBoolean(key: string, value: boolean): Promise<void> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return; } try { await dataPreferences.put(key, value); await dataPreferences.flush(); } catch (error) { console.error(`Failed to put boolean for key ${key}:`, error); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L108-L121
a56c7eab8deee55dfeb47bc25a823e2b79b781fb
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets
arkts
decodeByFormatWithParameter
设置期望的format进行解码 @param imageSource - 图片资源实例。 @returns 位图操作实例。
public decodeByFormatWithParameter(imageSource: image.ImageSource): Promise<image.PixelMap> { Logger.info('getPixelMap DecodeByFormatWithParameter Start'); let decodingOptions: image.DecodingOptions = { editable: true, desiredPixelFormat: 3, // 以RGBA_8888格式进行解码 } return new Promise((resolve, reject) => { // 创建pixelMap imageSource.createPixelMap(decodingOptions).then((pixelMap: image.PixelMap) => { Logger.info('decodeByFormatWithParameter: ', 'Succeeded in creating PixelMap'); resolve(pixelMap); }).catch((err: BusinessError) => { Logger.error('decodeByFormatWithParameter: ', 'Failed to create PixelMap'); reject(err); }); }); }
AST#method_declaration#Left public decodeByFormatWithParameter AST#parameter_list#Left ( AST#parameter#Left imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_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#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 'getPixelMap DecodeByFormatWithParameter Start' 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 let AST#variable_declarator#Left decodingOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . DecodingOptions 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 editable 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 desiredPixelFormat AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // 以RGBA_8888格式进行解码 } 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#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#Left reject AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 创建pixelMap 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 AST#member_expression#Left AST#expression#Left imageSource AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left decodingOptions 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 pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap 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#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 'decodeByFormatWithParameter: ' AST#expression#Right , AST#expression#Left 'Succeeded in creating PixelMap' 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 resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixelMap 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 err : 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'decodeByFormatWithParameter: ' AST#expression#Right , AST#expression#Left 'Failed to create PixelMap' 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 err 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#method_declaration#Right
public decodeByFormatWithParameter(imageSource: image.ImageSource): Promise<image.PixelMap> { Logger.info('getPixelMap DecodeByFormatWithParameter Start'); let decodingOptions: image.DecodingOptions = { editable: true, desiredPixelFormat: 3, } return new Promise((resolve, reject) => { imageSource.createPixelMap(decodingOptions).then((pixelMap: image.PixelMap) => { Logger.info('decodeByFormatWithParameter: ', 'Succeeded in creating PixelMap'); resolve(pixelMap); }).catch((err: BusinessError) => { Logger.error('decodeByFormatWithParameter: ', 'Failed to create PixelMap'); reject(err); }); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L144-L160
5deaeb12e53e301e9a099b7efd20d17a137b0a5d
gitee
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/types/world.ets
arkts
随机挖矿事件数据归类
export interface TTypeEventBox { items: TMinerActionEventItem[] probability: number }
AST#export_declaration#Left export AST#interface_declaration#Left interface TTypeEventBox AST#object_type#Left { AST#type_member#Left items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TMinerActionEventItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left probability : AST#type_annotation#Left AST#primary_type#Left number 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 TTypeEventBox { items: TMinerActionEventItem[] probability: number }
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/types/world.ets#L29-L32
f5009f1d92adbea155e224a146c89dca62652299
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
getDownloadTask
获取下载任务状态
getDownloadTask(episodeId: string): DownloadTask | undefined { return this.downloadTasks.get(episodeId); }
AST#method_declaration#Left getDownloadTask AST#parameter_list#Left ( AST#parameter#Left episodeId : 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 DownloadTask 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#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 this AST#expression#Right . downloadTasks AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left episodeId 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
getDownloadTask(episodeId: string): DownloadTask | undefined { return this.downloadTasks.get(episodeId); }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L275-L277
d406270a276a6aa16453ca4420923d252fdb3647
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets
arkts
showEccSpecDetailInfo
打印ECC密钥规格
function showEccSpecDetailInfo(key: cryptoFramework.PubKey | cryptoFramework.PriKey, keyType: string) { console.info('show detail of ' + keyType + ':'); try { let p = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FP_P_BN); showBigIntInfo('--- p', p); // length is 224, hex : ffffffffffffffffffffffffffffffff000000000000000000000001 let a = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_A_BN); showBigIntInfo('--- a', a); // length is 224, hex : fffffffffffffffffffffffffffffffefffffffffffffffffffffffe let b = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_B_BN); showBigIntInfo('--- b', b); // length is 224, hex : b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4 let gX = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_G_X_BN); showBigIntInfo('--- gX', gX); // length is 224, hex : b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21 let gY = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_G_Y_BN); showBigIntInfo('--- gY', gY); // length is 224, hex : bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34 let n = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_N_BN); showBigIntInfo('--- n', n); // length is 224, hex : ffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d let h = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_H_NUM); console.warn('--- h: ' + h); // key h: 1 let fieldType = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FIELD_TYPE_STR); console.warn('--- field type: ' + fieldType); // key field type: Fp let fieldSize = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FIELD_SIZE_NUM); console.warn('--- field size: ' + fieldSize); // key field size: 224 let curveName = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_CURVE_NAME_STR); console.warn('--- curve name: ' + curveName); // key curve name: NID_secp224r1 if (keyType == 'priKey') { let sk = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_SK_BN); showBigIntInfo('--- sk', sk); } else if (keyType == 'pubKey') { let pkX = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_PK_X_BN); showBigIntInfo('--- pkX', pkX); let pkY = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_PK_Y_BN); showBigIntInfo('--- pkY', pkY); } } catch (error) { console.error('getAsyKeySpec error'); let e: BusinessError = error as BusinessError; console.error(`getAsyKeySpec failed, ${e.code}, ${e.message}`); } }
AST#function_declaration#Left function showEccSpecDetailInfo AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyType : 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#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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'show detail of ' AST#expression#Right + AST#expression#Left keyType AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ':' 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left p = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_FP_P_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- p' AST#expression#Right , AST#expression#Left p AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // length is 224, hex : ffffffffffffffffffffffffffffffff000000000000000000000001 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left a = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_A_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- a' AST#expression#Right , AST#expression#Left a AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // length is 224, hex : fffffffffffffffffffffffffffffffefffffffffffffffffffffffe AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left b = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_B_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- b' AST#expression#Right , AST#expression#Left b AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // length is 224, hex : b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left gX = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_G_X_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- gX' AST#expression#Right , AST#expression#Left gX AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // length is 224, hex : b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left gY = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_G_Y_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- gY' AST#expression#Right , AST#expression#Left gY AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // length is 224, hex : bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left n = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_N_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- n' AST#expression#Right , AST#expression#Left n AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // length is 224, hex : ffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left h = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_H_NUM 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '--- h: ' AST#expression#Right + AST#expression#Left h 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 // key h: 1 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fieldType = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_FIELD_TYPE_STR 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '--- field type: ' AST#expression#Right + AST#expression#Left fieldType 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 // key field type: Fp AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fieldSize = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_FIELD_SIZE_NUM 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '--- field size: ' AST#expression#Right + AST#expression#Left fieldSize 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 // key field size: 224 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left curveName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_CURVE_NAME_STR 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '--- curve name: ' AST#expression#Right + AST#expression#Left curveName 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 // key curve name: NID_secp224r1 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left keyType AST#expression#Right == AST#expression#Left 'priKey' 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 sk = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_SK_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- sk' AST#expression#Right , AST#expression#Left sk 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 keyType AST#expression#Right == AST#expression#Left 'pubKey' 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 pkX = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_PK_X_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- pkX' AST#expression#Right , AST#expression#Left pkX 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 let AST#variable_declarator#Left pkY = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . getAsyKeySpec 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 cryptoFramework AST#expression#Right . AsyKeySpecItem AST#member_expression#Right AST#expression#Right . ECC_PK_Y_BN 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showBigIntInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left '--- pkY' AST#expression#Right , AST#expression#Left pkY 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#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 'getAsyKeySpec error' 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 let AST#variable_declarator#Left e : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = 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#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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` getAsyKeySpec failed, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code 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 e 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function showEccSpecDetailInfo(key: cryptoFramework.PubKey | cryptoFramework.PriKey, keyType: string) { console.info('show detail of ' + keyType + ':'); try { let p = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FP_P_BN); showBigIntInfo('--- p', p); let a = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_A_BN); showBigIntInfo('--- a', a); let b = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_B_BN); showBigIntInfo('--- b', b); let gX = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_G_X_BN); showBigIntInfo('--- gX', gX); let gY = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_G_Y_BN); showBigIntInfo('--- gY', gY); let n = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_N_BN); showBigIntInfo('--- n', n); let h = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_H_NUM); console.warn('--- h: ' + h); let fieldType = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FIELD_TYPE_STR); console.warn('--- field type: ' + fieldType); let fieldSize = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_FIELD_SIZE_NUM); console.warn('--- field size: ' + fieldSize); let curveName = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_CURVE_NAME_STR); console.warn('--- curve name: ' + curveName); if (keyType == 'priKey') { let sk = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_SK_BN); showBigIntInfo('--- sk', sk); } else if (keyType == 'pubKey') { let pkX = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_PK_X_BN); showBigIntInfo('--- pkX', pkX); let pkY = key.getAsyKeySpec(cryptoFramework.AsyKeySpecItem.ECC_PK_Y_BN); showBigIntInfo('--- pkY', pkY); } } catch (error) { console.error('getAsyKeySpec error'); let e: BusinessError = error as BusinessError; console.error(`getAsyKeySpec failed, ${e.code}, ${e.message}`); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets#L60-L97
24cd77a9e8045ceb8eba8f9dbbb5a6247c6aa8bd
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
BillPage
账单页面
@Builder BillPage() { Column() { // 顶部标题栏 Row() { Text('明细') .fontSize(18) .fontColor('#333333') .fontWeight(FontWeight.Bold) Blank() Row() { Image($r('app.media.search_icon')) .width(22) .height(22) .fillColor('#666666') .margin({ right: 16 }) Image($r('app.media.calendar_icon')) .width(22) .height(22) .fillColor('#666666') } } .width('100%') .padding({ left: 20, right: 20, top: 16, bottom: 16 }) // 顶部统计卡片 Column() { Row() { Text(`${this.selectedYear}年 ${this.selectedMonth}月`) .fontSize(14) .fontColor('rgba(255, 255, 255, 0.9)') Text('▼') .fontSize(10) .fontColor('rgba(255, 255, 255, 0.9)') .margin({ left: 6 }) } .justifyContent(FlexAlign.Start) .margin({ bottom: 8 }) .onClick(() => { this.showDatePicker = true; // 点击显示日期选择器 }) Text(this.monthExpense) .fontSize(36) .fontColor('#FFFFFF') .fontWeight(FontWeight.Bold) .margin({ bottom: 16 }) Row() { Column() { Text('本月收入') .fontSize(12) .fontColor('rgba(255, 255, 255, 0.7)') .margin({ bottom: 4 }) Text(this.monthIncome) .fontSize(14) .fontColor('#FFFFFF') } .alignItems(HorizontalAlign.Start) Column() { Text('本月结余') .fontSize(12) .fontColor('rgba(255, 255, 255, 0.7)') .margin({ bottom: 4 }) Text(this.monthBalance) .fontSize(14) .fontColor('#FFFFFF') } .alignItems(HorizontalAlign.Start) .margin({ left: 60 }) } .width('100%') .justifyContent(FlexAlign.Start) } .width('90%') .padding(20) .margin({ top: 16, bottom: 16 }) .borderRadius(16) .alignItems(HorizontalAlign.Start) .linearGradient({ angle: 135, colors: [[0x5B7FFF, 0.0], [0x4A6FEE, 1.0]] }) // 账单列表区域 if (this.billList.length === 0) { Column() { Image($r('app.media.empty_bill')) .width(120) .height(120) .objectFit(ImageFit.Contain) .opacity(0.5) .margin({ bottom: 20 }) Text('暂无账单记录') .fontSize(16) .fontColor('#999999') } .width('100%') .layoutWeight(1) .justifyContent(FlexAlign.Center) .offset({ y: -100 }) } else { List() { ForEach(this.dateGroups, (group: DateGroup, groupIndex: number) => { ListItem() { Column() { // 日期标题行 Row() { Text(this.formatDateDisplay(group.date)) .fontSize(13) .fontColor('#999999') Blank() Text(`支: ${this.calculateDayStats(group.bills).expense}`) .fontSize(12) .fontColor('#666666') .margin({ left: 16 }) Text(`收: ${this.calculateDayStats(group.bills).income}`) .fontSize(12) .fontColor('#666666') .margin({ left: 16 }) } .width('100%') .padding({ left: 16, right: 16, top: 12, bottom: 12 }) // 该日期下的所有账单 List() { ForEach(group.bills, (bill: BillItem, index: number) => { ListItem() { Column() { // 账单项 Row() { // 图标 Image($r(`app.media.category_${bill.categoryIcon}`)) .width(40) .height(40) .fillColor('#5B7FFF') .margin({ right: 12 }) // 分类和备注 Column() { Text(bill.category) .fontSize(15) .fontColor('#333333') .margin({ bottom: 4 }) if (bill.remark) { Text(bill.remark) .fontSize(12) .fontColor('#999999') } } .alignItems(HorizontalAlign.Start) Blank() // 金额 Text((bill.type === 0 ? '-' : '+') + bill.amount) .fontSize(16) .fontColor(bill.type === 0 ? '#333333' : '#FF6B6B') .fontWeight(FontWeight.Medium) } .width('100%') .padding({ left: 16, right: 16, top: 12, bottom: 12 }) .backgroundColor('#FFFFFF') .borderRadius(index === group.bills.length - 1 ? { bottomLeft: 12, bottomRight: 12 } : 0) // 分隔线(不是最后一项时显示) if (index < group.bills.length - 1) { Divider() .color('#F0F0F0') .strokeWidth(1) .margin({ left: 68, right: 16 }) } } } .swipeAction({ end: this.DeleteBillButton(bill.id) }) }, (bill: BillItem) => `${bill.id}_${this.refreshFlag}`) } .width('100%') } .width('100%') .backgroundColor('#FFFFFF') .borderRadius(12) .clip(true) } .margin({ bottom: 12 }) }, (group: DateGroup) => `${group.date}_${this.refreshFlag}`) } .width('100%') .layoutWeight(1) .padding({ left: 16, right: 16, top: 10 }) } } .width('100%') .height('100%') .alignItems(HorizontalAlign.Center) .backgroundColor('#E3ECFF') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right BillPage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 顶部标题栏 AST#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 . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' 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#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 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 Row ( ) 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#resource_expression#Left $r ( AST#expression#Left 'app.media.search_icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left '#666666' AST#expression#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 16 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#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.calendar_icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left '#666666' 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#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 left AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 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 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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedYear 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 . selectedMonth 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 'rgba(255, 255, 255, 0.9)' 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 . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(255, 255, 255, 0.9)' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 6 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#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 . Start AST#member_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 bottom AST#property_name#Right : AST#expression#Left 8 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showDatePicker 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#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#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 this AST#expression#Right . monthExpense AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 36 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#FFFFFF' 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 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#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#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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(255, 255, 255, 0.7)' 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 4 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#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 this AST#expression#Right . monthIncome AST#member_expression#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 '#FFFFFF' 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 . 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#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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '本月结余' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(255, 255, 255, 0.7)' 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 4 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#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 this AST#expression#Right . monthBalance AST#member_expression#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 '#FFFFFF' 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 . 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#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left 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#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 . 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#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 '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 20 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 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 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#Left . linearGradient ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 135 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left colors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x5B7FFF AST#expression#Right , AST#expression#Left 0.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x4A6FEE AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ] AST#array_literal#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#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 this AST#expression#Right . billList 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#container_content_body#Left { 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.empty_bill' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.5 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 20 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#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 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' 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 . 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 . 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#unary_expression#Left - AST#expression#Left 100 AST#expression#Right AST#unary_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 } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) 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 . dateGroups AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left group : AST#type_annotation#Left AST#primary_type#Left DateGroup AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left groupIndex : 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 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatDateDisplay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left group AST#expression#Right . date AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 13 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' 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 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 Text ( AST#expression#Left AST#template_literal#Left ` 支: AST#template_substitution#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 . calculateDayStats AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left group AST#expression#Right . bills AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . expense 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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 16 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#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#template_literal#Left ` 收: AST#template_substitution#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 . calculateDayStats AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left group AST#expression#Right . bills AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . income 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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 16 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#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 left AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 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 List ( ) 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 group AST#expression#Right . bills AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bill : AST#type_annotation#Left AST#primary_type#Left BillItem 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 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left AST#template_literal#Left ` app.media.category_ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . categoryIcon AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left '#5B7FFF' AST#expression#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 12 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . category AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' 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 4 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#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 bill AST#expression#Right . remark 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#member_expression#Left AST#expression#Left bill AST#expression#Right . remark AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' 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#container_content_body#Right AST#ui_component#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#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 Text ( 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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . type 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#expression#Right : AST#expression#Left '+' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left bill AST#expression#Right AST#binary_expression#Right AST#expression#Right . amount AST#member_expression#Right 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 AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#333333' AST#expression#Right : AST#expression#Left '#FF6B6B' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium 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#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 left AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#conditional_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 index AST#expression#Right === AST#expression#Left group AST#expression#Right AST#binary_expression#Right AST#expression#Right . bills 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right : AST#expression#Left 0 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#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 group AST#expression#Right AST#binary_expression#Right AST#expression#Right . bills 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 Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left '#F0F0F0' AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 68 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 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#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#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 . DeleteBillButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . id 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#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 bill : AST#type_annotation#Left AST#primary_type#Left BillItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . id 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 . refreshFlag AST#member_expression#Right 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#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 . backgroundColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . clip ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_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 bottom AST#property_name#Right : AST#expression#Left 12 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 group : AST#type_annotation#Left AST#primary_type#Left DateGroup AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left group AST#expression#Right . date 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 . refreshFlag AST#member_expression#Right 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#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 . layoutWeight ( AST#expression#Left 1 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 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 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#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 . height ( 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 . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#E3ECFF' 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#builder_function_body#Right AST#method_declaration#Right
@Builder BillPage() { Column() { Row() { Text('明细') .fontSize(18) .fontColor('#333333') .fontWeight(FontWeight.Bold) Blank() Row() { Image($r('app.media.search_icon')) .width(22) .height(22) .fillColor('#666666') .margin({ right: 16 }) Image($r('app.media.calendar_icon')) .width(22) .height(22) .fillColor('#666666') } } .width('100%') .padding({ left: 20, right: 20, top: 16, bottom: 16 }) Column() { Row() { Text(`${this.selectedYear}年 ${this.selectedMonth}月`) .fontSize(14) .fontColor('rgba(255, 255, 255, 0.9)') Text('▼') .fontSize(10) .fontColor('rgba(255, 255, 255, 0.9)') .margin({ left: 6 }) } .justifyContent(FlexAlign.Start) .margin({ bottom: 8 }) .onClick(() => { this.showDatePicker = true; }) Text(this.monthExpense) .fontSize(36) .fontColor('#FFFFFF') .fontWeight(FontWeight.Bold) .margin({ bottom: 16 }) Row() { Column() { Text('本月收入') .fontSize(12) .fontColor('rgba(255, 255, 255, 0.7)') .margin({ bottom: 4 }) Text(this.monthIncome) .fontSize(14) .fontColor('#FFFFFF') } .alignItems(HorizontalAlign.Start) Column() { Text('本月结余') .fontSize(12) .fontColor('rgba(255, 255, 255, 0.7)') .margin({ bottom: 4 }) Text(this.monthBalance) .fontSize(14) .fontColor('#FFFFFF') } .alignItems(HorizontalAlign.Start) .margin({ left: 60 }) } .width('100%') .justifyContent(FlexAlign.Start) } .width('90%') .padding(20) .margin({ top: 16, bottom: 16 }) .borderRadius(16) .alignItems(HorizontalAlign.Start) .linearGradient({ angle: 135, colors: [[0x5B7FFF, 0.0], [0x4A6FEE, 1.0]] }) if (this.billList.length === 0) { Column() { Image($r('app.media.empty_bill')) .width(120) .height(120) .objectFit(ImageFit.Contain) .opacity(0.5) .margin({ bottom: 20 }) Text('暂无账单记录') .fontSize(16) .fontColor('#999999') } .width('100%') .layoutWeight(1) .justifyContent(FlexAlign.Center) .offset({ y: -100 }) } else { List() { ForEach(this.dateGroups, (group: DateGroup, groupIndex: number) => { ListItem() { Column() { Row() { Text(this.formatDateDisplay(group.date)) .fontSize(13) .fontColor('#999999') Blank() Text(`支: ${this.calculateDayStats(group.bills).expense}`) .fontSize(12) .fontColor('#666666') .margin({ left: 16 }) Text(`收: ${this.calculateDayStats(group.bills).income}`) .fontSize(12) .fontColor('#666666') .margin({ left: 16 }) } .width('100%') .padding({ left: 16, right: 16, top: 12, bottom: 12 }) List() { ForEach(group.bills, (bill: BillItem, index: number) => { ListItem() { Column() { Row() { Image($r(`app.media.category_${bill.categoryIcon}`)) .width(40) .height(40) .fillColor('#5B7FFF') .margin({ right: 12 }) Column() { Text(bill.category) .fontSize(15) .fontColor('#333333') .margin({ bottom: 4 }) if (bill.remark) { Text(bill.remark) .fontSize(12) .fontColor('#999999') } } .alignItems(HorizontalAlign.Start) Blank() Text((bill.type === 0 ? '-' : '+') + bill.amount) .fontSize(16) .fontColor(bill.type === 0 ? '#333333' : '#FF6B6B') .fontWeight(FontWeight.Medium) } .width('100%') .padding({ left: 16, right: 16, top: 12, bottom: 12 }) .backgroundColor('#FFFFFF') .borderRadius(index === group.bills.length - 1 ? { bottomLeft: 12, bottomRight: 12 } : 0) if (index < group.bills.length - 1) { Divider() .color('#F0F0F0') .strokeWidth(1) .margin({ left: 68, right: 16 }) } } } .swipeAction({ end: this.DeleteBillButton(bill.id) }) }, (bill: BillItem) => `${bill.id}_${this.refreshFlag}`) } .width('100%') } .width('100%') .backgroundColor('#FFFFFF') .borderRadius(12) .clip(true) } .margin({ bottom: 12 }) }, (group: DateGroup) => `${group.date}_${this.refreshFlag}`) } .width('100%') .layoutWeight(1) .padding({ left: 16, right: 16, top: 10 }) } } .width('100%') .height('100%') .alignItems(HorizontalAlign.Center) .backgroundColor('#E3ECFF') }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L574-L778
da503630b82140a85cd5ac77f3b001d6901fd716
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets
arkts
decodeMsg
解析二进制数据转为字符串 @param buffer
private decodeMsg(buffer: ArrayBuffer): string { Logger.info(TAG, `buffer type = ${typeof buffer}`); Logger.info(TAG, `buffer = ${buffer}`); let dataView = new Uint8Array(buffer); Logger.info(TAG, `length = ${dataView.byteLength}`); let data = ''; for (let i = 0; i < dataView.byteLength; ++i) { let c = String.fromCharCode(dataView[i]); if (c !== '\n') { data += c; } } return data; }
AST#method_declaration#Left private decodeMsg AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer 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#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 TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` buffer type = AST#template_substitution#Left $ { AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left buffer AST#expression#Right AST#unary_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#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 TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` buffer = AST#template_substitution#Left $ { AST#expression#Left buffer 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 let AST#variable_declarator#Left dataView = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left buffer 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 Logger 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 AST#template_literal#Left ` length = AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left dataView AST#expression#Right . byteLength 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#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data = AST#expression#Left '' 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 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#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left dataView AST#expression#Right AST#binary_expression#Right AST#expression#Right . byteLength 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 let AST#variable_declarator#Left c = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left dataView AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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 c AST#expression#Right !== AST#expression#Left '\n' 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 data += AST#expression#Left c 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 AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private decodeMsg(buffer: ArrayBuffer): string { Logger.info(TAG, `buffer type = ${typeof buffer}`); Logger.info(TAG, `buffer = ${buffer}`); let dataView = new Uint8Array(buffer); Logger.info(TAG, `length = ${dataView.byteLength}`); let data = ''; for (let i = 0; i < dataView.byteLength; ++i) { let c = String.fromCharCode(dataView[i]); if (c !== '\n') { data += c; } } return data; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets#L125-L138
a099c611dad54cd52de8d30f134298aa0020702c
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/listener/EventControl.ets
arkts
Copyright (C) 2022 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 const enum EventType { SingleTap, DoubleTap, LongPress }
AST#export_declaration#Left export AST#enum_declaration#Left const enum EventType AST#enum_body#Left { AST#enum_member#Left SingleTap AST#enum_member#Right , AST#enum_member#Left DoubleTap AST#enum_member#Right , AST#enum_member#Left LongPress AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export const enum EventType { SingleTap, DoubleTap, LongPress }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/EventControl.ets#L16-L20
3685d0b1ac5e025c79bb427a98fec00eb17572c4
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets
arkts
getWithFuncParam
[End opt_funcParam] [Start with_func_param]
@Builder function getWithFuncParam(name: string): void { if (name === Constants.NAV_DESTINATION_ITEM_3) { NavDestination() { WithFuncParam() } .title(title()) .backgroundColor('#F1F3F5') } }
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function getWithFuncParam 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_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 AST#binary_expression#Left AST#expression#Left name AST#expression#Right === AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . NAV_DESTINATION_ITEM_3 AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left WithFuncParam ( ) 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 . title ( AST#expression#Left AST#call_expression#Left AST#expression#Left title AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F1F3F5' 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#builder_function_body#Right AST#decorated_function_declaration#Right
@Builder function getWithFuncParam(name: string): void { if (name === Constants.NAV_DESTINATION_ITEM_3) { NavDestination() { WithFuncParam() } .title(title()) .backgroundColor('#F1F3F5') } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets#L161-L170
a860fc1be0563f39255eb8163fbfae639a3a547e
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderListViewModel.ets
arkts
hideRebuyModal
隐藏再次购买弹窗 @returns {void} 无返回值
hideRebuyModal(): void { this.rebuyModalVisible = false; }
AST#method_declaration#Left hideRebuyModal 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 . rebuyModalVisible 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#builder_function_body#Right AST#method_declaration#Right
hideRebuyModal(): void { this.rebuyModalVisible = false; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderListViewModel.ets#L80-L82
fd9e8920659b4e53cf74e364110e2c097bc16074
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Multi_device_V2/common/index.ets
arkts
BottomTabsItem
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, 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 { BottomTabsItem } from './src/main/ets/viewmodel/BottomTabsItem';
AST#export_declaration#Left export { BottomTabsItem } from './src/main/ets/viewmodel/BottomTabsItem' ; AST#export_declaration#Right
export { BottomTabsItem } from './src/main/ets/viewmodel/BottomTabsItem';
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Multi_device_V2/common/index.ets#L16-L16
d40e42bfdb088888d7b28212a4ce217d3118356d
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/web/WebPrint/entry/src/main/ets/pages/Index.ets
arkts
print
打印web组件内容
print() { if (this.webPrintAdapter == undefined) { this.webPrintAdapter = this.controller.createWebPrintDocumentAdapter("webPrint"); } this.controller.setPrintBackground(this.printBackground) print.print("printJob", this.webPrintAdapter, null, getContext()) .then((task: print.PrintTask) => { task.on('succeed', () => { console.log('print state is succeed'); }) }) }
AST#method_declaration#Left print 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 this AST#expression#Right . webPrintAdapter AST#member_expression#Right AST#expression#Right == AST#expression#Left undefined 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 . webPrintAdapter 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 . controller AST#member_expression#Right AST#expression#Right . createWebPrintDocumentAdapter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "webPrint" 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_if_statement#Right AST#ui_control_flow#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 . controller AST#member_expression#Right AST#expression#Right . setPrintBackground 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 . printBackground 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left print AST#expression#Right . print AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "printJob" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webPrintAdapter AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , 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 ) 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 task : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left print . PrintTask 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'succeed' AST#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#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 'print state is succeed' 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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
print() { if (this.webPrintAdapter == undefined) { this.webPrintAdapter = this.controller.createWebPrintDocumentAdapter("webPrint"); } this.controller.setPrintBackground(this.printBackground) print.print("printJob", this.webPrintAdapter, null, getContext()) .then((task: print.PrintTask) => { task.on('succeed', () => { console.log('print state is succeed'); }) }) }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/web/WebPrint/entry/src/main/ets/pages/Index.ets#L65-L77
6e23c15fb63fbc4a7d4eb4ed5e7f67310d15c1fa
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
alertDialog
操作确认类弹出框
alertDialog(index: number) { if (index == 0) { //简单使用 DialogHelper.showAlertDialog({ uiContext:this.getUIContext(), backgroundColor: Color.Orange, content: "确定保存该WPS文件吗?", onAction: (action) => { if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您点击了取消按钮`); } else if (action == DialogAction.SURE) { ToastUtil.showToast(`您点击了确认按钮`); } } }) } else if (index == 1) { //自定义按钮颜色 DialogHelper.showAlertDialog({ title: "提示", content: "确定保存该视频文件吗?", // primaryButton:'取消', secondaryButton: { value: "确认", fontColor: Color.Brown }, onAction: (action) => { if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您取消了保存`); } else if (action == DialogAction.SURE) { ToastUtil.showToast(`已保存`); } } }) } else if (index == 2) { //自定义按钮和二级标题 DialogHelper.showAlertDialog({ primaryTitle: "提示", secondaryTitle: "保存前请确认文件", content: "确定保存该视频文件吗", primaryButton: "取消", secondaryButton: $r('app.string.btn_save'), onAction: (action) => { if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您取消了保存`); } else if (action == DialogAction.SURE) { ToastUtil.showToast(`已保存`); } } }) } else { //不带标题,不主动关闭弹框 DialogHelper.showAlertDialog({ title: "", content: "确定保存该视频文件吗", actionCancel: false, //点击操作按钮不关闭弹框 autoCancel: false, //点击遮障层时,不关闭弹窗 backCancel: false, //点击返回键,不关闭弹窗 onAction: (action, dialogId) => { DialogHelper.closeDialog(dialogId); //关闭弹框 if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您取消了保存`); } else if (action == DialogAction.SURE) { ToastUtil.showToast(`已保存`); } } }) } }
AST#method_declaration#Left alertDialog 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index 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 DialogHelper AST#expression#Right . showAlertDialog 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 uiContext 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 . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Orange AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left "确定保存该WPS文件吗?" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAction AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left action 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#binary_expression#Left AST#expression#Left action AST#expression#Right == AST#expression#Left DialogAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . CANCEL 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 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_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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left action AST#expression#Right == AST#expression#Left DialogAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . SURE 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 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_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#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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right == AST#expression#Left 1 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 DialogHelper AST#expression#Right . showAlertDialog 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 title AST#property_name#Right : AST#expression#Left "提示" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left "确定保存该视频文件吗?" AST#expression#Right AST#property_assignment#Right , // primaryButton:'取消', AST#property_assignment#Left AST#property_name#Left secondaryButton AST#property_name#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#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Brown AST#member_expression#Right 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 onAction AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left action 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#binary_expression#Left AST#expression#Left action AST#expression#Right == AST#expression#Left DialogAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . CANCEL 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 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_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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left action AST#expression#Right == AST#expression#Left DialogAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . SURE 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 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_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#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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right == AST#expression#Left 2 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 DialogHelper AST#expression#Right . showAlertDialog 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 primaryTitle AST#property_name#Right : AST#expression#Left "提示" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryTitle AST#property_name#Right : AST#expression#Left "保存前请确认文件" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left "确定保存该视频文件吗" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left primaryButton AST#property_name#Right : AST#expression#Left "取消" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryButton AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.btn_save' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAction AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left action 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#binary_expression#Left AST#expression#Left action AST#expression#Right == AST#expression#Left DialogAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . CANCEL 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 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_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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left action AST#expression#Right == AST#expression#Left DialogAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . SURE 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 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_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#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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else { //不带标题,不主动关闭弹框 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . showAlertDialog 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 title AST#property_name#Right : AST#expression#Left "" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left "确定保存该视频文件吗" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left actionCancel AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false 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 false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , //点击遮障层时,不关闭弹窗 AST#property_assignment#Left AST#property_name#Left backCancel AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , //点击返回键,不关闭弹窗 AST#property_assignment#Left AST#property_name#Left onAction AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left action AST#parameter#Right , AST#parameter#Left dialogId 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 DialogHelper AST#expression#Right . closeDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dialogId 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 action AST#expression#Right == AST#expression#Left DialogAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . CANCEL 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 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_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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left action AST#expression#Right == AST#expression#Left DialogAction AST#expression#Right AST#binary_expression#Right AST#expression#Right . SURE 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 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_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#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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
alertDialog(index: number) { if (index == 0) { DialogHelper.showAlertDialog({ uiContext:this.getUIContext(), backgroundColor: Color.Orange, content: "确定保存该WPS文件吗?", onAction: (action) => { if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您点击了取消按钮`); } else if (action == DialogAction.SURE) { ToastUtil.showToast(`您点击了确认按钮`); } } }) } else if (index == 1) { DialogHelper.showAlertDialog({ title: "提示", content: "确定保存该视频文件吗?", secondaryButton: { value: "确认", fontColor: Color.Brown }, onAction: (action) => { if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您取消了保存`); } else if (action == DialogAction.SURE) { ToastUtil.showToast(`已保存`); } } }) } else if (index == 2) { DialogHelper.showAlertDialog({ primaryTitle: "提示", secondaryTitle: "保存前请确认文件", content: "确定保存该视频文件吗", primaryButton: "取消", secondaryButton: $r('app.string.btn_save'), onAction: (action) => { if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您取消了保存`); } else if (action == DialogAction.SURE) { ToastUtil.showToast(`已保存`); } } }) } else { DialogHelper.showAlertDialog({ title: "", content: "确定保存该视频文件吗", actionCancel: false, autoCancel: false, backCancel: false, onAction: (action, dialogId) => { DialogHelper.closeDialog(dialogId); if (action == DialogAction.CANCEL) { ToastUtil.showToast(`您取消了保存`); } else if (action == DialogAction.SURE) { ToastUtil.showToast(`已保存`); } } }) } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L189-L256
0ee0d6792d2a7e572e2716613e4628fbd3de15a9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets
arkts
onWindowStageDestroy
[StartExclude save_the_uiContext_to_localstorage_in_entry_ability]
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
AST#method_declaration#Left onWindowStageDestroy 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 { // Main window is destroyed, release UI related resources 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 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'Ability onWindowStageDestroy' 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
onWindowStageDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L48-L51
4999a82cf1f18171e5faef0ae29857fadf257d17
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
AI服务提供商枚举
export enum AIProvider { ZHIPU = 'zhipu', // 智谱AI 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 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/types/GreetingTypes.ets#L137-L142
c32c108b9f1bdb5f3f04a922558468fdb5c854b6
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/Viewmodel/CategoryInfo.ets
arkts
储存记录的类别
export default class CategoryInfo { category: string; icon: string; ordinal: number; typeName: string; constructor(category: string, icon: string, ordinal: number, type: string) { this.category = category; this.icon = icon; this.ordinal = ordinal; this.typeName = type; } }
AST#export_declaration#Left export default AST#class_declaration#Left class CategoryInfo AST#class_body#Left { AST#property_declaration#Left category : 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 icon : 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 ordinal : 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 typeName : 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 category : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ordinal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 . category AST#member_expression#Right = AST#expression#Left category 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 . icon AST#member_expression#Right = AST#expression#Left icon 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 . ordinal AST#member_expression#Right = AST#expression#Left ordinal 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 . typeName AST#member_expression#Right = AST#expression#Left type 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 default class CategoryInfo { category: string; icon: string; ordinal: number; typeName: string; constructor(category: string, icon: string, ordinal: number, type: string) { this.category = category; this.icon = icon; this.ordinal = ordinal; this.typeName = type; } }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/CategoryInfo.ets#L3-L15
627dacac7e5a0ad96859ba5823a2897950bcf2e8
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/utils/DateUtil.ets
arkts
getWeekdayName
获取星期名称
static getWeekdayName(day: number): string { const weekdays = ['日', '一', '二', '三', '四', '五', '六'] return weekdays[day] }
AST#method_declaration#Left static getWeekdayName AST#parameter_list#Left ( AST#parameter#Left day : 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#variable_declaration#Left const AST#variable_declarator#Left weekdays = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '日' AST#expression#Right , AST#expression#Left '一' AST#expression#Right , AST#expression#Left '二' AST#expression#Right , AST#expression#Left '三' AST#expression#Right , AST#expression#Left '四' AST#expression#Right , AST#expression#Left '五' 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#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left weekdays AST#expression#Right [ AST#expression#Left day 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
static getWeekdayName(day: number): string { const weekdays = ['日', '一', '二', '三', '四', '五', '六'] return weekdays[day] }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L108-L111
f5907c06ea6383281eefb5abebeb099b80e5c4b8
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/DialogUtil.ets
arkts
closeCustomDialogById
根据弹窗id关闭弹窗 @param dialogId
public static closeCustomDialogById(dialogId: string) { if (!DialogUtil.uiContext) { return; } let promptAction = DialogUtil.uiContext.getPromptAction(); let compCont = DialogUtil.compContMap.get(dialogId); if (compCont) { DialogUtil.compContMap.delete(dialogId); promptAction.closeCustomDialog(compCont); // 关闭弹框之后释放对应的ComponentContent compCont.dispose(); } }
AST#method_declaration#Left public static closeCustomDialogById AST#parameter_list#Left ( AST#parameter#Left dialogId : 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left DialogUtil AST#expression#Right AST#unary_expression#Right AST#expression#Right . uiContext 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#variable_declaration#Left let AST#variable_declarator#Left promptAction = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogUtil AST#expression#Right . uiContext AST#member_expression#Right AST#expression#Right . getPromptAction 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 compCont = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogUtil AST#expression#Right . compContMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dialogId 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 compCont 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#member_expression#Left AST#expression#Left DialogUtil AST#expression#Right . compContMap AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dialogId 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 promptAction AST#expression#Right . closeCustomDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left compCont AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 关闭弹框之后释放对应的ComponentContent AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left compCont AST#expression#Right . dispose 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#method_declaration#Right
public static closeCustomDialogById(dialogId: string) { if (!DialogUtil.uiContext) { return; } let promptAction = DialogUtil.uiContext.getPromptAction(); let compCont = DialogUtil.compContMap.get(dialogId); if (compCont) { DialogUtil.compContMap.delete(dialogId); promptAction.closeCustomDialog(compCont); compCont.dispose(); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/DialogUtil.ets#L57-L69
28e2f9399e8478dd841bb31dcafb449136dce422
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/KeyItemNumber.ets
arkts
KeyItemNumber
有大小写的按键组件
@Component export struct KeyItemNumber { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume keyState: number; private keyValue: keySourceListType | undefined = undefined; build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { if (AppStorage.get<boolean>('isLandscape') && deviceInfo.deviceType === 'phone' && this.keyValue) { Stack({ alignContent: Alignment.TopEnd }) { Text(this.keyState === KeyState.LOWER_CASE ? this.keyValue.content : this.keyValue.upperContent) .fontSize(this.inputStyle.en_fontSize) .fontColor(Color.Black) .fontWeight(FontWeight.Regular) .width('100%') .height('100%') .textAlign(TextAlign.Center) Text(this.keyValue.title) .fontSize(this.inputStyle.litterNumberFontSize) .fontColor(Color.Black) .fontWeight(FontWeight.Regular) .width('12vp') .height('12vp') .textAlign(TextAlign.Center) .margin({ top: 1, right: 1 }) } .width('100%') .height('100%') } else if (this.keyValue) { Text(this.keyValue.title) .fontSize(this.inputStyle.litterNumberFontSize) .fontColor($r('app.color.key_item_normal_text')) .fontWeight(FontWeight.Regular) .margin({ top: 4 }) Text(this.keyState === KeyState.LOWER_CASE ? this.keyValue.content : this.keyValue.upperContent) .fontSize(this.inputStyle.en_fontSize) .fontColor(Color.Black) .fontWeight(FontWeight.Regular) } } .backgroundColor($r('app.color.key_item_normal')) .borderRadius(4) .onClick(() => { if (this.keyState === KeyState.LOWER_CASE && this.keyValue) { InputHandler.getInstance().insertText(this.keyValue.content); } else if (this.keyValue) { if (this.keyState === KeyState.ONCE_UPPER_CASE) { this.keyState = KeyState.LOWER_CASE; } InputHandler.getInstance().insertText(this.keyValue.upperContent); } }) .width(this.inputStyle.basicButtonWidth) .height('100%') .shadow({ radius: 1, color: $r('app.color.shadow'), offsetY: 3 }) .stateStyles({ normal: normalStyles, pressed: pressedStyles }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct KeyItemNumber AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Left AST#primary_type#Left KeyStyle 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 StyleConfiguration AST#expression#Right . getSavedInputStyle 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 AST#decorator#Left @ Consume AST#decorator#Right keyState : 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 private keyValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left keySourceListType 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 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#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#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#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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right 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#argument_list#Left ( AST#expression#Left 'isLandscape' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left deviceInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right . deviceType AST#member_expression#Right AST#expression#Right === AST#expression#Left 'phone' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . keyValue AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopEnd 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#member_expression#Left 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 this AST#expression#Right . keyState AST#member_expression#Right AST#expression#Right === AST#expression#Left KeyState AST#expression#Right AST#binary_expression#Right AST#expression#Right . LOWER_CASE 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 . keyValue AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . keyValue AST#member_expression#Right AST#expression#Right . upperContent AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . en_fontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Regular 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 . height ( AST#expression#Left '100%' 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 ) 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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keyValue AST#member_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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . litterNumberFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Regular AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '12vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '12vp' 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 ) 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 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 1 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 . width ( AST#expression#Left '100%' 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keyValue 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keyValue AST#member_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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . litterNumberFontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.key_item_normal_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Regular AST#member_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 4 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#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 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 this AST#expression#Right . keyState AST#member_expression#Right AST#expression#Right === AST#expression#Left KeyState AST#expression#Right AST#binary_expression#Right AST#expression#Right . LOWER_CASE 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 . keyValue AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . keyValue AST#member_expression#Right AST#expression#Right . upperContent AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . en_fontSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Regular 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_if_statement#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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.key_item_normal' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 4 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#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 this AST#expression#Right . keyState AST#member_expression#Right AST#expression#Right === AST#expression#Left KeyState AST#expression#Right AST#binary_expression#Right AST#expression#Right . LOWER_CASE AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . keyValue 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left InputHandler 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 . insertText 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 . keyValue AST#member_expression#Right AST#expression#Right . content 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keyValue AST#member_expression#Right AST#expression#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 . keyState AST#member_expression#Right AST#expression#Right === AST#expression#Left KeyState AST#expression#Right AST#binary_expression#Right AST#expression#Right . ONCE_UPPER_CASE AST#member_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 . keyState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left KeyState AST#expression#Right . LOWER_CASE 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#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 InputHandler 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 . insertText 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 . keyValue AST#member_expression#Right AST#expression#Right . upperContent 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputStyle AST#member_expression#Right AST#expression#Right . basicButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius 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 AST#resource_expression#Left $r ( AST#expression#Left 'app.color.shadow' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . stateStyles ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left normalStyles AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left pressed AST#property_name#Right : AST#expression#Left pressedStyles 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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct KeyItemNumber { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume keyState: number; private keyValue: keySourceListType | undefined = undefined; build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { if (AppStorage.get<boolean>('isLandscape') && deviceInfo.deviceType === 'phone' && this.keyValue) { Stack({ alignContent: Alignment.TopEnd }) { Text(this.keyState === KeyState.LOWER_CASE ? this.keyValue.content : this.keyValue.upperContent) .fontSize(this.inputStyle.en_fontSize) .fontColor(Color.Black) .fontWeight(FontWeight.Regular) .width('100%') .height('100%') .textAlign(TextAlign.Center) Text(this.keyValue.title) .fontSize(this.inputStyle.litterNumberFontSize) .fontColor(Color.Black) .fontWeight(FontWeight.Regular) .width('12vp') .height('12vp') .textAlign(TextAlign.Center) .margin({ top: 1, right: 1 }) } .width('100%') .height('100%') } else if (this.keyValue) { Text(this.keyValue.title) .fontSize(this.inputStyle.litterNumberFontSize) .fontColor($r('app.color.key_item_normal_text')) .fontWeight(FontWeight.Regular) .margin({ top: 4 }) Text(this.keyState === KeyState.LOWER_CASE ? this.keyValue.content : this.keyValue.upperContent) .fontSize(this.inputStyle.en_fontSize) .fontColor(Color.Black) .fontWeight(FontWeight.Regular) } } .backgroundColor($r('app.color.key_item_normal')) .borderRadius(4) .onClick(() => { if (this.keyState === KeyState.LOWER_CASE && this.keyValue) { InputHandler.getInstance().insertText(this.keyValue.content); } else if (this.keyValue) { if (this.keyState === KeyState.ONCE_UPPER_CASE) { this.keyState = KeyState.LOWER_CASE; } InputHandler.getInstance().insertText(this.keyValue.upperContent); } }) .width(this.inputStyle.basicButtonWidth) .height('100%') .shadow({ radius: 1, color: $r('app.color.shadow'), offsetY: 3 }) .stateStyles({ normal: normalStyles, pressed: pressedStyles }) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/components/KeyItemNumber.ets#L30-L89
a2efc5cb99e8161d1c6a86b9c48cce050c0a6249
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
strToBase64
字符串转Base64字符串 @param src 字符串 @returns
static strToBase64(src: string): string { const uint8Array = StrUtil.strToUint8Array(src); const result = Base64Util.encodeToStrSync(uint8Array); return result; }
AST#method_declaration#Left static strToBase64 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_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 uint8Array = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left src 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Base64Util AST#expression#Right . encodeToStrSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uint8Array 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 result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static strToBase64(src: string): string { const uint8Array = StrUtil.strToUint8Array(src); const result = Base64Util.encodeToStrSync(uint8Array); return result; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L312-L316
be237430bf540cf899d13d5de42406294a0204f7
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/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/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Chip.d.ets#L309-L330
50a772acadf10ca90081f99d52511a09aed5a171
github
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/common/dialog/CommonIconAlertDialog.ets
arkts
CommonIconAlertDialog
Icon+Text自定义弹窗
@CustomDialog export struct CommonIconAlertDialog { @Prop icon:ResourceStr @Prop textStr:string controller?: CustomDialogController build() { Column() { Image(this.icon) .width(176) .height(176) Text(this.textStr) .fontColor('#ffffff') .fontSize(30) .margin({top:15}) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) .backgroundColor('#1A1A1A') .borderRadius(20) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommonIconAlertDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#ERROR#Left AST#decorator#Left @ Prop AST#decorator#Right textStr : string controller ? : CustomDialogController AST#ERROR#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 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 this AST#expression#Right . icon AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 176 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 176 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 this AST#expression#Right . textStr AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 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 15 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#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 . height ( 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 . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#1A1A1A' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 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
@CustomDialog export struct CommonIconAlertDialog { @Prop icon:ResourceStr @Prop textStr:string controller?: CustomDialogController build() { Column() { Image(this.icon) .width(176) .height(176) Text(this.textStr) .fontColor('#ffffff') .fontSize(30) .margin({top:15}) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) .backgroundColor('#1A1A1A') .borderRadius(20) } }
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/dialog/CommonIconAlertDialog.ets#L4-L28
9689fd68ea52f554da071e78a3740477a7caef83
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
未读消息数量 @param date @returns
export function getUnRead() { return axiosClient.get<number>({ url: `message/lg/count_unread/json`, checkLoginState: true, }) }
AST#export_declaration#Left export AST#function_declaration#Left function getUnRead AST#parameter_list#Left ( ) 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 axiosClient AST#expression#Right . get AST#member_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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` message/lg/count_unread/json ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left checkLoginState 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getUnRead() { return axiosClient.get<number>({ url: `message/lg/count_unread/json`, checkLoginState: true, }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L289-L294
b1ab095beefe1c566177f607e1ba0a6e1150704b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets
arkts
disableBluetooth
关闭蓝牙功能
disableBluetooth(): void { Log.showInfo(TAG, `disableBluetooth`); try { this.offBTStateChange(); access.disableBluetooth(); } catch (err) { Log.showError(TAG, `disableBluetooth: err = ${err}`); } }
AST#method_declaration#Left disableBluetooth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showInfo 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 ` disableBluetooth ` 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 this AST#expression#Right . offBTStateChange 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 access AST#expression#Right . disableBluetooth 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#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 Log AST#expression#Right . showError 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 ` disableBluetooth: err = 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
disableBluetooth(): void { Log.showInfo(TAG, `disableBluetooth`); try { this.offBTStateChange(); access.disableBluetooth(); } catch (err) { Log.showError(TAG, `disableBluetooth: err = ${err}`); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets#L82-L90
e6f65a11833aa6198f9a7abb8ee0747e15e3a037
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
applyTheme
应用主题
private async applyTheme(theme: ThemeConfig): Promise<void> { // TODO: 实现实际的主题应用逻辑 // 这里可以通过全局资源管理器或状态管理来应用主题 hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Applying theme: ${theme.type}`); }
AST#method_declaration#Left private async applyTheme AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left ThemeConfig 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 { // TODO: 实现实际的主题应用逻辑 // 这里可以通过全局资源管理器或状态管理来应用主题 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 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 ` Applying theme: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . type 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#builder_function_body#Right AST#method_declaration#Right
private async applyTheme(theme: ThemeConfig): Promise<void> { hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Applying theme: ${theme.type}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L778-L782
9c7c68647a8b397525d72e509a8fba7e9edbe0a6
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/ThemeManager.ets
arkts
addGlobalThemeChangeCallback
全局主题变化通知
static addGlobalThemeChangeCallback(callback: () => void): void { AppThemeManager.globalThemeChangeCallbacks.push(callback); }
AST#method_declaration#Left static addGlobalThemeChangeCallback AST#parameter_list#Left ( AST#parameter#Left callback : 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#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 AST#member_expression#Left AST#expression#Left AppThemeManager AST#expression#Right . globalThemeChangeCallbacks AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left callback 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 addGlobalThemeChangeCallback(callback: () => void): void { AppThemeManager.globalThemeChangeCallbacks.push(callback); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L119-L121
10bc13722c86f69fb41a08c93f4ac3206622aea1
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
encryptGCMSegmentSync
加密(GCM模式)分段,同步 @param dataBlob 加密或者解密的数据。dataBlob不能为null。 @param key 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES128|GCM|PKCS7、AES192|GCM|PKCS7、AES256|GCM|PKCS7、、等)。 @param len 自定义的数据拆分长度。 @returns
static encryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7', len: number = 128): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher(transformation); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, gcmParams); let encryptData = new Uint8Array(); for (let i = 0; i < dataBlob.data.length; i += len) { let updateData = dataBlob.data.subarray(i, i + len); let updateDataBlob: cryptoFramework.DataBlob = { data: updateData }; let updateOutput = cipher.updateSync(updateDataBlob); //分段update let mergeTData = new Uint8Array(encryptData.length + updateOutput.data.length); mergeTData.set(encryptData); mergeTData.set(updateOutput.data, encryptData.length); encryptData = mergeTData; } gcmParams.authTag = cipher.doFinalSync(null); let encryptBlob: cryptoFramework.DataBlob = { data: encryptData }; return encryptBlob; }
AST#method_declaration#Left static encryptGCMSegmentSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . Key AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left gcmParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . GcmParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'AES256|GCM|PKCS7' AST#expression#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 128 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_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 cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left transformation 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 cipher AST#expression#Right . initSync 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 cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . ENCRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left key AST#expression#Right , AST#expression#Left gcmParams 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 let AST#variable_declarator#Left encryptData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array 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#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 dataBlob AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len 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 updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataBlob AST#expression#Right . data AST#member_expression#Right AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len 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 updateDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob 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 data AST#property_name#Right : AST#expression#Left updateData 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 updateOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipher AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateDataBlob 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 //分段update AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mergeTData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left encryptData AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left updateOutput AST#expression#Right AST#binary_expression#Right AST#expression#Right . data 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#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 mergeTData AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left encryptData 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 mergeTData AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updateOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left encryptData 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#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left encryptData = AST#expression#Left mergeTData AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_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#assignment_expression#Left AST#member_expression#Left AST#expression#Left gcmParams AST#expression#Right . authTag AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipher AST#expression#Right . doFinalSync AST#member_expression#Right 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left encryptBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob 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 data AST#property_name#Right : AST#expression#Left encryptData 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 encryptBlob AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static encryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7', len: number = 128): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher(transformation); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, gcmParams); let encryptData = new Uint8Array(); for (let i = 0; i < dataBlob.data.length; i += len) { let updateData = dataBlob.data.subarray(i, i + len); let updateDataBlob: cryptoFramework.DataBlob = { data: updateData }; let updateOutput = cipher.updateSync(updateDataBlob); let mergeTData = new Uint8Array(encryptData.length + updateOutput.data.length); mergeTData.set(encryptData); mergeTData.set(updateOutput.data, encryptData.length); encryptData = mergeTData; } gcmParams.authTag = cipher.doFinalSync(null); let encryptBlob: cryptoFramework.DataBlob = { data: encryptData }; return encryptBlob; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L298-L316
a4cd83e818dce05476aa499e08674f0ddd20fa79
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getAllUnits
获取所有单元 类似Swift的var allUnits: [Unit] { get }
getAllUnits(): Unit[] { return [...this.units]; // 返回副本以避免外部修改 }
AST#method_declaration#Left getAllUnits AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Unit [ ] AST#array_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#array_literal#Left [ ... AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . units AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 返回副本以避免外部修改 } AST#block_statement#Right AST#method_declaration#Right
getAllUnits(): Unit[] { return [...this.units]; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L305-L307
0e67d8944cc8574cf5feaffdc3b2e822add70294
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SM4.ets
arkts
@Author csx @DateTime 2024/3/18 10:15:03 @TODO SM4 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class SM4 { /** * 生成SM4的对称密钥 * @returns SM4密钥 */ static async generateSM4Key(): Promise<string> { return CryptoUtil.generateSymKey('SM4_128'); } /** * 加密-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); } /** * 解密-ECB模式 * @param str 加密的字符串 * @param sm4Key SM4密钥 */ static async decodeECB(str: string, sm4Key: string): Promise<string> { return CryptoUtil.decodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128); } /** * 加密-CBC模式 * @param str 待加密的字符串 * @param aesKey SM4密钥 * @param iv iv偏移量字符串 * @returns */ static async encodeCBC(str: string, sm4Key: string, iv: string): Promise<string> { return CryptoUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128); } /** * 解密-CBC模式 * @param str 加密的字符串 * @param aesKey SM4密钥 * @param iv iv偏移量字符串 * @returns */ static async decodeCBC(str: string, sm4Key: string, iv: string): Promise<string> { return CryptoUtil.decodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128); } }
AST#export_declaration#Left export AST#class_declaration#Left class SM4 AST#class_body#Left { /** * 生成SM4的对称密钥 * @returns SM4密钥 */ AST#method_declaration#Left static async generateSM4Key AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > 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 . generateSymKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'SM4_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 /** * 加密-ECB模式 * @param str 待加密的字符串 * @param sm4Key SM4密钥 * @returns */ 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 /** * 解密-ECB模式 * @param str 加密的字符串 * @param sm4Key SM4密钥 */ AST#method_declaration#Left static async decodeECB 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 . decodeECB 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 /** * 加密-CBC模式 * @param str 待加密的字符串 * @param aesKey SM4密钥 * @param iv iv偏移量字符串 * @returns */ AST#method_declaration#Left static async encodeCBC 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#Left iv : 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 . encodeCBC 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 iv AST#expression#Right , AST#expression#Left 'SM4_128' AST#expression#Right , AST#expression#Left 'SM4_128|CBC|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 /** * 解密-CBC模式 * @param str 加密的字符串 * @param aesKey SM4密钥 * @param iv iv偏移量字符串 * @returns */ AST#method_declaration#Left static async decodeCBC 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#Left iv : 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 . decodeCBC 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 iv AST#expression#Right , AST#expression#Left 'SM4_128' AST#expression#Right , AST#expression#Left 'SM4_128|CBC|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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class SM4 { static async generateSM4Key(): Promise<string> { return CryptoUtil.generateSymKey('SM4_128'); } static async encodeECB(str: string, sm4Key: string): Promise<string> { return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128); } static async decodeECB(str: string, sm4Key: string): Promise<string> { return CryptoUtil.decodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128); } static async encodeCBC(str: string, sm4Key: string, iv: string): Promise<string> { return CryptoUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128); } static async decodeCBC(str: string, sm4Key: string, iv: string): Promise<string> { return CryptoUtil.decodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7',128); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4.ets#L25-L76
b992b14b601164161d3780bf724d52c27622b2d0
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_008_F.ets
arkts
Introduction 库函数-string_replace
export function string_lib_func_008_F(taint_src : string) { let clean = "clean"; let t = clean.replace("a","b"); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_008_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 clean = AST#expression#Left "clean" 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 clean AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "a" AST#expression#Right , AST#expression#Left "b" 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 taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t 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 string_lib_func_008_F(taint_src : string) { let clean = "clean"; let t = clean.replace("a","b"); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_008_F.ets#L7-L11
06fdeac3922c731dcbddd364bebf38de2479f426
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets
arkts
getStatusColor
根据订单状态获取标签颜色
getStatusColor(status: string): ResourceStr { switch (status) { case '待接单': return '#FF5E81'; case '已接单': return '#2BCDDC'; case '回收中': return '#36B37E'; case '已完成': return '#6B778C'; default: return '#333333'; } }
AST#method_declaration#Left getStatusColor AST#parameter_list#Left ( AST#parameter#Left status : 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 ResourceStr 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 status 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#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#FF5E81' 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#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#2BCDDC' 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#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#36B37E' 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#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#6B778C' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '#333333' 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
getStatusColor(status: string): ResourceStr { switch (status) { case '待接单': return '#FF5E81'; case '已接单': return '#2BCDDC'; case '回收中': return '#36B37E'; case '已完成': return '#6B778C'; default: return '#333333'; } }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Recycle2.ets#L325-L333
c6eac1de5533a0171ade20fd308b07cc1ad81291
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/CandleDataSet.ets
arkts
setDecreasingPaintStyle
Sets paint style when open > close @param decreasingPaintStyle
public setDecreasingPaintStyle(decreasingPaintStyle: Style): void { this.mDecreasingPaintStyle = decreasingPaintStyle; }
AST#method_declaration#Left public setDecreasingPaintStyle AST#parameter_list#Left ( AST#parameter#Left decreasingPaintStyle : AST#type_annotation#Left AST#primary_type#Left Style 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 . mDecreasingPaintStyle AST#member_expression#Right = AST#expression#Left decreasingPaintStyle AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setDecreasingPaintStyle(decreasingPaintStyle: Style): void { this.mDecreasingPaintStyle = decreasingPaintStyle; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CandleDataSet.ets#L256-L258
07242c5015733bbae47a85c3f8aa0cb83119f742
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/SetAppFontSize/entry/src/main/ets/viewmodel/SettingData.ets
arkts
Setting list item info.
export default class SettingData { /** * Setting list item name. */ settingName: Resource = $r('app.string.empty'); /** * Setting list item image. */ settingImage: Resource = $r('app.string.empty'); }
AST#export_declaration#Left export default AST#class_declaration#Left class SettingData AST#class_body#Left { /** * Setting list item name. */ AST#property_declaration#Left settingName : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.empty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * Setting list item image. */ AST#property_declaration#Left settingImage : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.empty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class SettingData { settingName: Resource = $r('app.string.empty'); settingImage: Resource = $r('app.string.empty'); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/viewmodel/SettingData.ets#L19-L29
76caca5ccde8a24bf855164ba89ad507e9308389
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/shortcut/ShortcutManager.ets
arkts
createCustomShortcut
创建自定义快捷方式
async createCustomShortcut(config: Partial<ShortcutConfig>): Promise<string> { try { const shortcutId = `custom_${Date.now()}`; const shortcut: ShortcutInfo = { id: shortcutId, shortLabel: config.label || '自定义快捷方式', longLabel: config.description || '自定义快捷方式描述', iconId: $r('app.media.ic_shortcut'), wants: [{ bundleName: 'com.harmonyos.birthdayreminder', abilityName: 'EntryAbility', parameters: config.params || {} }] }; await shortcutManager.addShortcut(shortcut); // 记录配置 const fullConfig: ShortcutConfig = { id: shortcutId, type: config.type || ShortcutType.ADD_CONTACT, label: config.label || '', description: config.description || '', icon: config.icon || 'ic_shortcut', targetPage: config.targetPage || '', params: config.params, isStatic: false, priority: config.priority || 5 }; this.shortcuts.set(shortcutId, fullConfig); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Custom shortcut created: ${shortcutId}`); return shortcutId; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to create custom shortcut: ${error}`); throw error; } }
AST#method_declaration#Left async createCustomShortcut AST#parameter_list#Left ( AST#parameter#Left config : 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 ShortcutConfig 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 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left shortcutId = AST#expression#Left AST#template_literal#Left ` custom_ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#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 shortcut : AST#type_annotation#Left AST#primary_type#Left ShortcutInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left shortcutId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left shortLabel AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . label AST#member_expression#Right AST#expression#Right || AST#expression#Left '自定义快捷方式' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left longLabel AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . description AST#member_expression#Right AST#expression#Right || AST#expression#Left '自定义快捷方式描述' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iconId AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_shortcut' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wants AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left 'com.harmonyos.birthdayreminder' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'EntryAbility' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left parameters AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . params AST#member_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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_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#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 shortcutManager AST#expression#Right AST#await_expression#Right AST#expression#Right . addShortcut AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left shortcut 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 fullConfig : AST#type_annotation#Left AST#primary_type#Left ShortcutConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left shortcutId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#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 config AST#expression#Right . type AST#member_expression#Right AST#expression#Right || AST#expression#Left ShortcutType AST#expression#Right AST#binary_expression#Right AST#expression#Right . ADD_CONTACT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left label AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . label AST#member_expression#Right AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . description AST#member_expression#Right AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . icon AST#member_expression#Right AST#expression#Right || AST#expression#Left 'ic_shortcut' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left targetPage AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . targetPage AST#member_expression#Right AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . params AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isStatic AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left priority AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . priority AST#member_expression#Right AST#expression#Right || AST#expression#Left 5 AST#expression#Right AST#binary_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shortcuts AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left shortcutId AST#expression#Right , AST#expression#Left fullConfig 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 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 ` Custom shortcut created: AST#template_substitution#Left $ { AST#expression#Left shortcutId 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 shortcutId 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 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 ` Failed to create custom shortcut: 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#throw_statement#Left throw AST#expression#Left error 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 createCustomShortcut(config: Partial<ShortcutConfig>): Promise<string> { try { const shortcutId = `custom_${Date.now()}`; const shortcut: ShortcutInfo = { id: shortcutId, shortLabel: config.label || '自定义快捷方式', longLabel: config.description || '自定义快捷方式描述', iconId: $r('app.media.ic_shortcut'), wants: [{ bundleName: 'com.harmonyos.birthdayreminder', abilityName: 'EntryAbility', parameters: config.params || {} }] }; await shortcutManager.addShortcut(shortcut); const fullConfig: ShortcutConfig = { id: shortcutId, type: config.type || ShortcutType.ADD_CONTACT, label: config.label || '', description: config.description || '', icon: config.icon || 'ic_shortcut', targetPage: config.targetPage || '', params: config.params, isStatic: false, priority: config.priority || 5 }; this.shortcuts.set(shortcutId, fullConfig); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Custom shortcut created: ${shortcutId}`); return shortcutId; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to create custom shortcut: ${error}`); throw error; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L339-L377
ae829e74bf374e212030dab01efa6c85c38824c1
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/storage/PreferencesUtil.ets
arkts
remove
删除指定键并 flush @param {string} key 键 @returns {Promise<void>} Promise<void>
async remove(key: string): Promise<void> { try { const prefs: preferences.Preferences = await this.getPrefs(); await prefs.delete(key); await prefs.flush(); } catch (error) { throw this.wrapError(error, `删除键 ${key} 失败`); } }
AST#method_declaration#Left async remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 prefs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences 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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right 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#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 prefs AST#expression#Right AST#await_expression#Right AST#expression#Right . delete 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#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 prefs AST#expression#Right AST#await_expression#Right AST#expression#Right . flush 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#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wrapError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 删除键 AST#template_substitution#Left $ { AST#expression#Left key 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 remove(key: string): Promise<void> { try { const prefs: preferences.Preferences = await this.getPrefs(); await prefs.delete(key); await prefs.flush(); } catch (error) { throw this.wrapError(error, `删除键 ${key} 失败`); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L89-L97
88b963574720be0ce25b754e17a9e81e53aa05a0
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/NotificationService.ets
arkts
sendVoiceReminder
发送语音提醒 @param task - 要提醒的任务 @param type - 提醒类型
private async sendVoiceReminder(task: Task, type: ReminderType): Promise<void> { // 检查语音提醒是否启用 if (!this.voiceReminderEnabled) { return; } // 检查是否已经语音提醒过 if (this.voiceNotifiedTaskIds.has(task.id)) { return; } // 检查TTS服务是否可用 if (!this.ttsService.isEnabled()) { return; } try { let voiceMessage = ''; if (type === ReminderType.TASK_UPCOMING) { // 计算剩余时间 const remainingMinutes = Math.round((task.dueTime - Date.now()) / 60000); if (remainingMinutes > 0) { voiceMessage = `提醒您,任务"${task.title}"将在${remainingMinutes}分钟后到期`; } else { voiceMessage = `提醒您,任务"${task.title}"即将到期`; } } else if (type === ReminderType.TASK_DUE) { voiceMessage = `任务提醒,"${task.title}"已到期,请及时处理`; } if (voiceMessage.length > 0) { await this.ttsService.speak(voiceMessage); this.voiceNotifiedTaskIds.add(task.id); console.info(`[NotificationService] 语音提醒已发送: ${task.title}`); } } catch (error) { console.error(`[NotificationService] 语音提醒发送失败: ${JSON.stringify(error)}`); } }
AST#method_declaration#Left private async sendVoiceReminder AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ReminderType 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#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 . voiceReminderEnabled 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#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 . voiceNotifiedTaskIds AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . id 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#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 检查TTS服务是否可用 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 AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . ttsService AST#member_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left voiceMessage = AST#expression#Left '' 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#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left ReminderType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TASK_UPCOMING AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 计算剩余时间 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left remainingMinutes = 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 AST#parenthesized_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#member_expression#Left AST#expression#Left task AST#expression#Right . dueTime AST#member_expression#Right AST#expression#Right - AST#expression#Left Date AST#expression#Right AST#binary_expression#Right AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 60000 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 remainingMinutes 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 voiceMessage = AST#expression#Left AST#template_literal#Left ` 提醒您,任务" AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right "将在 AST#template_substitution#Left $ { AST#expression#Left remainingMinutes AST#expression#Right } AST#template_substitution#Right 分钟后到期 ` AST#template_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 voiceMessage = AST#expression#Left AST#template_literal#Left ` 提醒您,任务" AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right "即将到期 ` AST#template_literal#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#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right === AST#expression#Left ReminderType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TASK_DUE AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left voiceMessage = AST#expression#Left AST#template_literal#Left ` 任务提醒," AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right "已到期,请及时处理 ` AST#template_literal#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#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 voiceMessage 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#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 . ttsService AST#member_expression#Right AST#expression#Right . speak AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left voiceMessage 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 . voiceNotifiedTaskIds AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left task 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#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 AST#template_literal#Left ` [NotificationService] 语音提醒已发送: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . title 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#if_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 ` [NotificationService] 语音提醒发送失败: 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 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async sendVoiceReminder(task: Task, type: ReminderType): Promise<void> { if (!this.voiceReminderEnabled) { return; } if (this.voiceNotifiedTaskIds.has(task.id)) { return; } if (!this.ttsService.isEnabled()) { return; } try { let voiceMessage = ''; if (type === ReminderType.TASK_UPCOMING) { const remainingMinutes = Math.round((task.dueTime - Date.now()) / 60000); if (remainingMinutes > 0) { voiceMessage = `提醒您,任务"${task.title}"将在${remainingMinutes}分钟后到期`; } else { voiceMessage = `提醒您,任务"${task.title}"即将到期`; } } else if (type === ReminderType.TASK_DUE) { voiceMessage = `任务提醒,"${task.title}"已到期,请及时处理`; } if (voiceMessage.length > 0) { await this.ttsService.speak(voiceMessage); this.voiceNotifiedTaskIds.add(task.id); console.info(`[NotificationService] 语音提醒已发送: ${task.title}`); } } catch (error) { console.error(`[NotificationService] 语音提醒发送失败: ${JSON.stringify(error)}`); } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/NotificationService.ets#L182-L221
96c76fb8701ac10c136a84adbedb0ec5c040d02f
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/TimerPage.ets
arkts
startStopwatch
秒表方法
startStopwatch() { this.stopwatchRunning = true; const startTime = Date.now() - this.stopwatchTime; this.stopwatchInterval = setInterval(() => { this.stopwatchTime = Date.now() - startTime; }, 10); }
AST#method_declaration#Left startStopwatch 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 . stopwatchRunning 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#variable_declaration#Left const AST#variable_declarator#Left startTime = 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 Date AST#expression#Right . now 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 this AST#expression#Right AST#binary_expression#Right AST#expression#Right . stopwatchTime 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . stopwatchInterval AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval 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 . stopwatchTime AST#member_expression#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 Date AST#expression#Right . now 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 startTime 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#arrow_function#Right AST#expression#Right , AST#expression#Left 10 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#method_declaration#Right
startStopwatch() { this.stopwatchRunning = true; const startTime = Date.now() - this.stopwatchTime; this.stopwatchInterval = setInterval(() => { this.stopwatchTime = Date.now() - startTime; }, 10); }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/TimerPage.ets#L528-L534
91e1dcacec2ab9ff1e5f60bf9ab2ce0b30626abc
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/navigation/NetworkListDemoNav.ets
arkts
NetworkListDemoNav
@file Network List Demo 示例页导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function NetworkListDemoNav(): void { NetworkListDemoPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function NetworkListDemoNav 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 NetworkListDemoPage ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function NetworkListDemoNav(): void { NetworkListDemoPage(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/navigation/NetworkListDemoNav.ets#L8-L11
3cac3567a5529318733309b4651563dc9cd038fd
github