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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets | arkts | encodeCBC192 | 加密-CBC模式-192位
@param str 待加密的字符串
@param aesKey AES密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64
@returns | static encodeCBC192(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES192', 'AES192|CBC|PKCS7', 192, keyCoding, resultCoding);
} | AST#method_declaration#Left static encodeCBC192 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static encodeCBC192(str: string, aesKey: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES192', 'AES192|CBC|PKCS7', 192, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L153-L156 | d2ea9f293d8def0e72b1ccccb6834b80db08a0e3 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | initDatas | 使用处代码 | async initDatas() {
import('../models/datas/book/BookDbAccess') .then((it) => { it.BookDbAccess.shared })
// import('../models/datas/word/WordDbAccess') .then((it) => { it.WordDbAccess.shared })
import('../models/datas/myData/WordUserDbAccess') .then((it) => { it... | AST#method_declaration#Left async initDatas AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#import_expression#Left import ( AST#expressi... | async initDatas() {
import('../models/datas/book/BookDbAccess') .then((it) => { it.BookDbAccess.shared })
import('../models/datas/myData/WordUserDbAccess') .then((it) => { it.WordUserDbAccess.shared })
import('../models/datas/model/SearchManager') .then((it) =... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/entryability/EntryAbility.ets#L131-L144 | ab776acfe1ab848705569f2363de7dd0517405e5 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/demoCollect/startAbility/frame/AbilityKit/DataSynchronization/entry/src/main/ets/viewModel/CommonData.ets | arkts | 金额 | constructor(type: string, money: number) {
this.type = type;
this.money = money;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left money : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | constructor(type: string, money: number) {
this.type = type;
this.money = money;
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/frame/AbilityKit/DataSynchronization/entry/src/main/ets/viewModel/CommonData.ets#L8-L11 | 432bfdc14dd508d25e7e3a1ee0ae2f1edb82d003 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets | arkts | @file 认证相关网络数据源实现类
@author Joker.X | export class AuthNetworkDataSourceImpl implements AuthNetworkDataSource {
/**
* 刷新 Token
* @param {Record<string, string>} params - 刷新参数
* @returns {Promise<NetworkResponse<Auth>>} 刷新后的认证信息
*/
async refreshToken(params: Record<string, string>): Promise<NetworkResponse<Auth>> {
const response: AxiosR... | AST#export_declaration#Left export AST#class_declaration#Left class AuthNetworkDataSourceImpl AST#implements_clause#Left implements AuthNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 刷新 Token
* @param {Record<string, string>} params - 刷新参数
* @returns {Promise<NetworkResponse<Auth>>} ... | export class AuthNetworkDataSourceImpl implements AuthNetworkDataSource {
async refreshToken(params: Record<string, string>): Promise<NetworkResponse<Auth>> {
const response: AxiosResponse<NetworkResponse<Auth>> =
await NetworkClient.http.post("user/login/refreshToken", params);
return response.data;... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets#L10-L32 | ec6d66aa5174e93672df8ac54dc3f2525f2de8cf | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets | arkts | isValid | Determine whether the current ratio is valid.
@returns | isValid(): boolean {
return (this.w > 0 && this.h > 0);
} | AST#method_declaration#Left isValid AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#parenthesized_expressi... | isValid(): boolean {
return (this.w > 0 && this.h > 0);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets#L75-L77 | 3c86e05dec9afbf850742b9a15d9743021c88425 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/validation/ValidationUtil.ets | arkts | isValidEmail | 验证邮箱地址是否有效
@param {string} email - 邮箱地址
@returns {boolean} 是否有效 | static isValidEmail(email: string): boolean {
return ValidationUtil.EMAIL_REGEX.test(email);
} | AST#method_declaration#Left static isValidEmail AST#parameter_list#Left ( AST#parameter#Left email : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | static isValidEmail(email: string): boolean {
return ValidationUtil.EMAIL_REGEX.test(email);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/validation/ValidationUtil.ets#L69-L71 | d0216f7db6c68b706aeda978b71a001ecf81a45e | github |
Classaspen/ArkTS_PasswordManagement.git | 66aea6e4f8ee3a78e5029c63186dba70707ca2d9 | entry/src/main/ets/components/database/Database.ets | arkts | getDeviceList | Query the list of devices within the network. | getDeviceList(): string[] {
let deviceManager: distributedDeviceManager.DeviceManager;
let deviceIds: string[] = [];
try {
// create deviceManager.
deviceManager = distributedDeviceManager.createDeviceManager('com.example.crossDeviceDataSynchronization');
// DeviceIds is obtained by callin... | AST#method_declaration#Left getDeviceList AST#parameter_list#Left ( ) 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... | getDeviceList(): string[] {
let deviceManager: distributedDeviceManager.DeviceManager;
let deviceIds: string[] = [];
try {
deviceManager = distributedDeviceManager.createDeviceManager('com.example.crossDeviceDataSynchronization');
if (deviceManager != null) {
let devices = ... | https://github.com/Classaspen/ArkTS_PasswordManagement.git/blob/66aea6e4f8ee3a78e5029c63186dba70707ca2d9/entry/src/main/ets/components/database/Database.ets#L188-L208 | 124eab20f8742d78cf92df0235b2181b1e31de99 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | getCommemorationsInMonth | 获取本月的纪念日
@param month 月份
@param year 年份(可选) | async getCommemorationsInMonth(month: number, year?: number): Promise<CommemorationEntity[]> {
this.checkInitialization();
return await this.commemorationDAO.getCommemorationsInMonth(month, year);
} | AST#method_declaration#Left async getCommemorationsInMonth AST#parameter_list#Left ( AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left year ? : AST#type_annotation#Left AST#primary_type#Left number A... | async getCommemorationsInMonth(month: number, year?: number): Promise<CommemorationEntity[]> {
this.checkInitialization();
return await this.commemorationDAO.getCommemorationsInMonth(month, year);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L194-L197 | ac532f5234f1903633ddbe4b98569b05f47bba27 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/IdCardUtil.ets | arkts | getDistrictCodeByIdCard | 根据身份编号获取区县级编码,只支持15或18位身份证号码
@param idCard 身份编码
@return 省份编码 | static getDistrictCodeByIdCard(idCard: string): OutDTO<string> {
if (IdCardUtil.PROVINCE_CODES.size == 0) {
IdCardUtil.init();
}
let len = idCard.length;
if (len == IdCardUtil.CHINA_ID_MIN_LENGTH || len == IdCardUtil.CHINA_ID_MAX_LENGTH) {
let district = IdCardUtil.DISTRICT_CODES.get(idCard.... | AST#method_declaration#Left static getDistrictCodeByIdCard AST#parameter_list#Left ( AST#parameter#Left idCard : 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#gene... | static getDistrictCodeByIdCard(idCard: string): OutDTO<string> {
if (IdCardUtil.PROVINCE_CODES.size == 0) {
IdCardUtil.init();
}
let len = idCard.length;
if (len == IdCardUtil.CHINA_ID_MIN_LENGTH || len == IdCardUtil.CHINA_ID_MAX_LENGTH) {
let district = IdCardUtil.DISTRICT_CODES.get(idCard.... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/IdCardUtil.ets#L280-L294 | c1339291f5806163ca977beb61939ed80b0707d8 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | 视频播放状态 | export class MediaPlayerStatus {
public redLineProgress: number = 0; // [0,1]
public isPlaying: boolean = false; // true播放 false暂停
} | AST#export_declaration#Left export AST#class_declaration#Left class MediaPlayerStatus AST#class_body#Left { AST#property_declaration#Left public redLineProgress : 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#pro... | export class MediaPlayerStatus {
public redLineProgress: number = 0;
public isPlaying: boolean = false;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets#L31-L34 | d9a69106adab1b68a34187998b82886aaed74c4b | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildSettingsItem | 构建设置项 | @Builder
buildSettingsItem(item: SettingsItem, isLast: boolean) {
Row({ space: 12 }) {
Column({ space: 2 }) {
Text(item.title)
.fontSize(14)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Text(item.subtitle)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSettingsItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left SettingsItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLast : AST#type_annot... | @Builder
buildSettingsItem(item: SettingsItem, isLast: boolean) {
Row({ space: 12 }) {
Column({ space: 2 }) {
Text(item.title)
.fontSize(14)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Text(item.subtitle)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L1373-L1426 | 28e67de577760b4c0666c6cca0d7389ed57638b3 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/share/SharePage.ets | arkts | buildTemplateDialog | 构建模板选择对话框 | @Builder
buildTemplateDialog() {
Column({ space: UIConstants.DEFAULT_PADDING }) {
Text('选择分享模板')
.fontSize(UIConstants.FONT_SIZE_HEADING)
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.text_primary'))
Scroll() {
Column({ space: UIConstants.SMALL_PADDING }) {
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTemplateDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component... | @Builder
buildTemplateDialog() {
Column({ space: UIConstants.DEFAULT_PADDING }) {
Text('选择分享模板')
.fontSize(UIConstants.FONT_SIZE_HEADING)
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.text_primary'))
Scroll() {
Column({ space: UIConstants.SMALL_PADDING }) {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/share/SharePage.ets#L426-L485 | 9ff26ac9c30db4b504a551381212e109cb43f4ae | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/DataSet.ets | arkts | setValues | /** * This method is deprecated. * Use setEntries(...) instead. * * @param values @Deprecated | public setValues(values: JArrayList<T>): void {
this.setEntries(values);
} | AST#method_declaration#Left public setValues AST#parameter_list#Left ( AST#parameter#Left values : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_argume... | public setValues(values: JArrayList<T>): void {
this.setEntries(values);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/DataSet.ets#L159-L161 | e7a3074d674d426ac94e0f91c67768264521d302 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogBuilder.ets | arkts | ActionSheetDialogBuilder | /** * 底部滑出菜单弹窗view * @param options @Builder export function BottomSheetDialogBuilder(options: IBottomSheetOptions) { BottomSheetDialogView({ options: options }); }
菜单弹窗view
@param options | @Builder
export function ActionSheetDialogBuilder(options: IBottomSheetOptions) {
ActionSheetDialogView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ActionSheetDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IBottomSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right )... | @Builder
export function ActionSheetDialogBuilder(options: IBottomSheetOptions) {
ActionSheetDialogView({ options: options });
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L251-L254 | d8cd001f206c43dbaccf0bdfcbf7ea6e9d4d52a6 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | limitRectInRotatedBasedOnPoint | Based on point rotating, limit rect.
@param baseIndex
@param rect
@param rotatedLines | static limitRectInRotatedBasedOnPoint(baseIndex: number, rect: RectF, rotatedLines: Array<LineSegment>): void {
let points = MathUtils.rectToPoints(rect);
let base = points[baseIndex];
points.splice(baseIndex, 1);
let scale = 1;
for (let point of points) {
let line = new LineSegment(base, poin... | AST#method_declaration#Left static limitRectInRotatedBasedOnPoint AST#parameter_list#Left ( AST#parameter#Left baseIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rect : AST#type_annotation#Left AST#primary_type#Left... | static limitRectInRotatedBasedOnPoint(baseIndex: number, rect: RectF, rotatedLines: Array<LineSegment>): void {
let points = MathUtils.rectToPoints(rect);
let base = points[baseIndex];
points.splice(baseIndex, 1);
let scale = 1;
for (let point of points) {
let line = new LineSegment(base, poin... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L320-L389 | fd4d29b6501975448629228587dd5c6898b03127 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UsingWebMultimedia/entry2/src/main/ets/entry2ability/Entry2Ability.ets | arkts | onWindowStageCreate | [EndExclude allow_subsequent_rendering_to_use_ui] | onWindowStageCreate(windowStage: window.WindowStage): void {
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
return;
}
// 保存 UIContext, 在后续的同层渲染绘制中会用到。
AppStorage.setOrCreate<UIContext>('UIContext', windowStage.getMainWindowSync().getUIContext());
});
} | AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | onWindowStageCreate(windowStage: window.WindowStage): void {
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
return;
}
AppStorage.setOrCreate<UIContext>('UIContext', windowStage.getMainWindowSync().getUIContext());
});
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UsingWebMultimedia/entry2/src/main/ets/entry2ability/Entry2Ability.ets#L31-L39 | d2e8f52bdec98bcfd0937ca5e59e12813a5f70cd | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_downloads.ets | arkts | init_delegate | Initializes the download delegate for blob downloads.
Delegate: AppStorage.get('dl_delegate') | init_delegate(storage: LocalStorage) {
// Init blob_delegate
let dl_delegate = storage.get('dl_delegate') as webview.WebDownloadDelegate;
dl_delegate.onBeforeDownload((webDownloadItem: webview.WebDownloadItem) => {
console.log('[bunch_of_downloads][init_delegate] onBeforeDownload: [' + webDownloadIte... | AST#method_declaration#Left init_delegate AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // Init blob_delegate AST#statement#Left... | init_delegate(storage: LocalStorage) {
let dl_delegate = storage.get('dl_delegate') as webview.WebDownloadDelegate;
dl_delegate.onBeforeDownload((webDownloadItem: webview.WebDownloadItem) => {
console.log('[bunch_of_downloads][init_delegate] onBeforeDownload: [' + webDownloadItem.getSuggestedFileNam... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_downloads.ets#L37-L67 | 2b02a6b764780785146676e4b1e6031eff2fa6e2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/view/CardSwiper.ets | arkts | CardSwiperAnimationComponent | 功能说明:本示例通过Swiper、Image组件实现卡片预览效果和滚动切换, 通过linearGradient实现主题背景色渐变和滑动边缘渐变
推荐场景:不同比例卡片滚动切换、主题色随卡片中图片渐变
核心组件:
1. CardSwiperComponent: 卡片组件滚动切换组件, 叠底渐变背景, 遮盖渐变边缘
2. CardComponent: 卡片子组件, 展示全模态窗图片或缩略图
实现步骤:
1. 构建 initCardsList 数组, 向组件中传入初始化内容; 数组中每项包括 src: 图片路径, with: 单卡片宽度, height: 单卡片高度
根据想要展示的比例设置对应宽度和高度,如宽: 高为1: 2展示时,... | @Component
export struct CardSwiperAnimationComponent {
// 卡片列表
initCardsList : CardInfo[] = [];
// 边缘渐变
isEdgeFading : boolean = true;
// 主题背景渐变
isBackgroundColorChange : boolean = true;
// 开启预览大图
isShowPreviewImage : boolean = true;
aboutToAppear() :void {
this.initCardsList = [
// 卡片比例 1... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CardSwiperAnimationComponent AST#component_body#Left { // 卡片列表 AST#property_declaration#Left initCardsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CardInfo [ ] AST#array_type#Right AST#pri... | @Component
export struct CardSwiperAnimationComponent {
initCardsList : CardInfo[] = [];
isEdgeFading : boolean = true;
isBackgroundColorChange : boolean = true;
isShowPreviewImage : boolean = true;
aboutToAppear() :void {
this.initCardsList = [
{ src: $r('app.media.panda'), widt... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/view/CardSwiper.ets#L59-L104 | e65f58fdec79239b5551efadacaa8cde6dffe03d | gitee |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/utils/PreferenceModel.ets | arkts | setPassword | 写入密码 | async setPassword(userAccount: string, password: string) {
await this.putPreference(userAccount, password);
} | AST#method_declaration#Left async setPassword AST#parameter_list#Left ( AST#parameter#Left userAccount : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | async setPassword(userAccount: string, password: string) {
await this.putPreference(userAccount, password);
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L100-L102 | 4274f538503b420d97a84652981374d464f252a3 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets | arkts | aboutToResize | 当布局大小发生变化时进行回调 | aboutToResize(size: Size) {
console.log('aboutToResize width : ' + size.width + ' height : ' + size.height );
} | AST#method_declaration#Left aboutToResize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Size AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#... | aboutToResize(size: Size) {
console.log('aboutToResize width : ' + size.width + ' height : ' + size.height );
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets#L56-L58 | 495f0c3592c44378c3ce8d0bc7f54e10e15f0229 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/view/BottomDrawerSlideCase.ets | arkts | 窗口管理model | build() {
Stack({ alignContent: Alignment.TopStart }) {
RelativeContainer() {
// Image地图
ImageMapView()
.id('map')
// list上部的标题栏
this.itemHead('安全出行季')
/**
* 抽屉视图
* @param { ()=>void } searchAddress - 搜索视图
* @param {()=>void} listBui... | 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#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right .... | build() {
Stack({ alignContent: Alignment.TopStart }) {
RelativeContainer() {
ImageMapView()
.id('map')
this.itemHead('安全出行季')
BottomDrawer({
searchAddress: this.searchAddress,
listBuilder: ()=>{
this.listBuilder();
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/view/BottomDrawerSlideCase.ets#L82-L117 | f4c7703ab29d0f8ae9dbfa2787f9deb93169844b | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets | arkts | 日期信息。用于选择日期回调 | export interface CalendarData {
year: number, // 年
month: number, // 月
date: number // 日
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CalendarData AST#object_type#Left { AST#type_member#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , // 年 AST#type_member#Left month : AST#type_annotation... | export interface CalendarData {
year: number,
month: number,
date: number
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets#L42-L46 | 2c045949f0063b214ac72ad3dcb7b72daeca3802 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/viewmodel/NetworkListDemoViewModel.ets | arkts | @file Network List Demo 示例页 ViewModel
@author Joker.X | @ObservedV2
export default class NetworkListDemoViewModel extends BaseNetWorkListViewModel<Goods> {
/**
* 商品仓库
*/
private repository: GoodsRepository = new GoodsRepository();
/**
* 请求商品分页数据
* @returns {Promise<NetworkResponse<NetworkPageData<Goods>>>} 网络请求 Promise
*/
protected requestListData():... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class NetworkListDemoViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkListViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#... | @ObservedV2
export default class NetworkListDemoViewModel extends BaseNetWorkListViewModel<Goods> {
private repository: GoodsRepository = new GoodsRepository();
protected requestListData(): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const request: GoodsSearchRequest = new GoodsSearchRequest();
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/NetworkListDemoViewModel.ets#L9-L26 | 527ea69dace5baf4ee9f1f295fc0457d12a72314 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/InteractiveGameService.ets | arkts | 游戏表现接口 | export interface GamePerformance {
accuracy: number; // 准确率
speed: number; // 速度得分
efficiency: number; // 效率得分
streak: number; // 连击数
perfectRounds: number; // 完美回合数
rating: PerformanceRating;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GamePerformance AST#object_type#Left { AST#type_member#Left accuracy : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 准确率 AST#type_member#Left speed : AST#type_a... | export interface GamePerformance {
accuracy: number;
speed: number;
efficiency: number;
streak: number;
perfectRounds: number;
rating: PerformanceRating;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L99-L106 | 8d24eac4f8975d1b700c6ef5ab5507b184000dfd | github | |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/model/WindowModel.ets | arkts | setWindowStage | 设置 WindowStage(在 EntryAbility 中调用)
Set windowStage.
@param windowStage The object of WindowStage. | setWindowStage(windowStage: window.WindowStage) {
this.windowStage = windowStage;
} | AST#method_declaration#Left setWindowStage AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#b... | setWindowStage(windowStage: window.WindowStage) {
this.windowStage = windowStage;
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/model/WindowModel.ets#L52-L54 | 8f14fa589462fd8caa2a6f47e89eb9265f8b9a06 | github |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | onReceivedUpdatePageMessage | 收到page推送消息
@param otaStatus 状态数据 | async onReceivedUpdatePageMessage(otaStatus: OtaStatus): Promise<void> {
this.log('receives from onReceivedUpdatePageMessage:' + JSON.stringify(otaStatus));
this.notifyUpdateStatus(otaStatus, globalThis.abilityContext);
} | AST#method_declaration#Left async onReceivedUpdatePageMessage AST#parameter_list#Left ( AST#parameter#Left otaStatus : AST#type_annotation#Left AST#primary_type#Left OtaStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left... | async onReceivedUpdatePageMessage(otaStatus: OtaStatus): Promise<void> {
this.log('receives from onReceivedUpdatePageMessage:' + JSON.stringify(otaStatus));
this.notifyUpdateStatus(otaStatus, globalThis.abilityContext);
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L358-L361 | fcecfb7682e5057c8f44b98f66b3fc87e83ab733 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets | arkts | selectSpec | 选择规格
@param {GoodsSpec} spec - 选中的规格 | selectSpec(spec: GoodsSpec): void {
// 如果点击的是已选中的规格,则取消选择
if (this.selectedSpec?.id === spec.id) {
this.selectedSpec = null;
} else {
this.selectedSpec = spec;
}
} | AST#method_declaration#Left selectSpec AST#parameter_list#Left ( AST#parameter#Left spec : AST#type_annotation#Left AST#primary_type#Left GoodsSpec 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... | selectSpec(spec: GoodsSpec): void {
if (this.selectedSpec?.id === spec.id) {
this.selectedSpec = null;
} else {
this.selectedSpec = spec;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L103-L110 | 512d60f5ecfe753953055fe9594e466c9631e368 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookPath.ets | arkts | / CloudBookList 的名称 | export const CBookListName : string = "BookList"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CBookListName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "BookList" AST#expression#Right AST#variable_declarator#Right ; AST#variable_de... | export const CBookListName : string = "BookList"; | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookPath.ets#L27-L27 | 47e28a3b143df5244b0931a2addef3409f1fed63 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | bytesToStr | Bytes转字符串
@param bytes
@returns | public static bytesToStr(bytes: Uint8Array): string {
let str = ""
for (let i = 0; i < bytes.length; i++) {
str += String.fromCharCode(bytes[i]);
}
return str;
} | AST#method_declaration#Left public static bytesToStr AST#parameter_list#Left ( AST#parameter#Left bytes : AST#type_annotation#Left AST#primary_type#Left Uint8Array 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#... | public static bytesToStr(bytes: Uint8Array): string {
let str = ""
for (let i = 0; i < bytes.length; i++) {
str += String.fromCharCode(bytes[i]);
}
return str;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L284-L291 | 841b4c9d3a990b6d0044b6a474b7e37780a47b3d | gitee |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/commons/components/QuestionListComp.ets | arkts | QuestionListComp | 后端返回的数据类型 不一定要完整的写 用什么写什么 每一个分类的类型 interface CateItemType { id: number name: string icon: string } | @Component
export struct QuestionListComp {
@Prop activeIndex: number = 0 // 哪个tab被选中 将来应该更新哪个list
@Prop index: number = 0 // 每个list对应的下标
@Prop @Watch('fn') sort: SortType = SortType.Default
// 传入的分类id
@Prop typeId: number
@Prop keyword: string = ''
@State list: QuestionItem[] = [] // 文章列表数据 暂时为空
@State... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct QuestionListComp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right activeIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#typ... | @Component
export struct QuestionListComp {
@Prop activeIndex: number = 0
@Prop index: number = 0
@Prop @Watch('fn') sort: SortType = SortType.Default
@Prop typeId: number
@Prop keyword: string = ''
@State list: QuestionItem[] = []
@State isRefreshing: boolean = false
@State isLoading: boolean... | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/components/QuestionListComp.ets#L41-L81 | 26fe07862a88cef426df90ebd9d50453f6054f2e | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/debug/DebugPanelParams.ets | arkts | @author open_9527
@date 2025/10/31
@desc DebugNodeParams | export enum DebugPanelNodeMode {
Default = 'Default',
Router = 'Router',
Log = 'Log',
System = 'System',
Network = 'Network',
Storage = 'Storage'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum DebugPanelNodeMode AST#enum_body#Left { AST#enum_member#Left Default = AST#expression#Left 'Default' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Router = AST#expression#Left 'Router' AST#expression#Right AST#enum_member#Right , AST#... | export enum DebugPanelNodeMode {
Default = 'Default',
Router = 'Router',
Log = 'Log',
System = 'System',
Network = 'Network',
Storage = 'Storage'
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/debug/DebugPanelParams.ets#L8-L15 | 7dbcd71a8e619d5f540fd7a69a28d639b027b406 | gitee | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/OtaPage.ets | arkts | getCurrentVersionPageInfo | 取当前版本数据
@param versionComponents 升级包
@param componentDescriptions 更新日志
@return VersionPageInfo 具体的当前版本数据 | public getCurrentVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions: Array<update.ComponentDescription>): VersionPageInfo {
let component: update.VersionComponent = versionComponents.filter((component: update.VersionComponent) => {
return component.componentType == up... | AST#method_declaration#Left public getCurrentVersionPageInfo AST#parameter_list#Left ( AST#parameter#Left versionComponents : 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 AST#qualified_type#Left update . VersionCompon... | public getCurrentVersionPageInfo(versionComponents: Array<update.VersionComponent>,
componentDescriptions: Array<update.ComponentDescription>): VersionPageInfo {
let component: update.VersionComponent = versionComponents.filter((component: update.VersionComponent) => {
return component.componentType == up... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/OtaPage.ets#L76-L93 | 4646d1d199845b4ff570039e68a823643f36a7c0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets | arkts | videoBackgroundSlot | 背景视频插槽。 | @Builder
videoBackgroundSlot() {
Video({ src: $r('app.media.click_animation_test_video') })
.height($r('app.string.click_animation_full_size'))
.width($r('app.string.click_animation_full_size'))
.autoPlay(true)
.loop(true)
.controls(false)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right videoBackgroundSlot 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 Video ( AST#component_parameters#Left { AST#component_... | @Builder
videoBackgroundSlot() {
Video({ src: $r('app.media.click_animation_test_video') })
.height($r('app.string.click_animation_full_size'))
.width($r('app.string.click_animation_full_size'))
.autoPlay(true)
.loop(true)
.controls(false)
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets#L169-L177 | c3a4be47e15cf3121755f361ff604feeb1f3424e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/GreetingsPage.ets | arkts | buildFloatingActionButton | 构建浮动操作按钮 | @Builder
buildFloatingActionButton() {
Stack() {
// AI生成按钮
Button() {
Text('🤖')
.fontSize(24)
}
.type(ButtonType.Circle)
.width('56vp')
.height('56vp')
.backgroundColor('#ff6b6b')
.position({ x: '100%', y: '100%' })
.translate({ x: -80, y: -... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFloatingActionButton 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 Stack ( ) AST#container_content_body#Left { // A... | @Builder
buildFloatingActionButton() {
Stack() {
Button() {
Text('🤖')
.fontSize(24)
}
.type(ButtonType.Circle)
.width('56vp')
.height('56vp')
.backgroundColor('#ff6b6b')
.position({ x: '100%', y: '100%' })
.translate({ x: -80, y: -140 })
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L585-L621 | 5cce54abbd04162a359e65ddce3b737aced95a16 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | RowSpaceBetweenTop | 横向两端分布 + 垂直顶部 | @ComponentV2
export struct RowSpaceBetweenTop {
/**
* Row 构造参数
*/
@Param
options: RowOptions | RowOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
@Param
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowSpaceBetweenTop AST#component_body#Left { /**
* Row 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_ty... | @ComponentV2
export struct RowSpaceBetweenTop {
@Param
options: RowOptions | RowOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Padding | ... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1105-L1180 | c27ccc61a5f7343464df063826e12f5a4732edff | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.base.d.ets | arkts | Defines the basic error callback.
@typedef { ErrorCallback<T extends Error = BusinessError> }
@syscap SystemCapability.Base
@crossplatform
@atomicservice
@since 20 | export type ErrorCallback<T extends Error = BusinessError> = (err: T)=> void; | AST#export_declaration#Left export AST#type_declaration#Left type ErrorCallback AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right = AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_ty... | export type ErrorCallback<T extends Error = BusinessError> = (err: T)=> void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.base.d.ets#L42-L42 | 0f0c751b79394c5aaec7617d7b2c6121615663d5 | gitee | |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/Index.ets | arkts | JhLoginTextInput | / JhForm | export { JhLoginTextInput } from './src/main/ets/JhForm/JhLoginTextInput' | AST#export_declaration#Left export { JhLoginTextInput } from './src/main/ets/JhForm/JhLoginTextInput' AST#export_declaration#Right | export { JhLoginTextInput } from './src/main/ets/JhForm/JhLoginTextInput' | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/Index.ets#L2-L2 | 47865824f5590b8dee7219d519db6ca42c1239ad | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/jobs/ViewPortJob.ets | arkts | Runnable that is used for viewport modifications since they cannot be
executed at any time. This can be used to delay the execution of viewport
modifications until the onSizeChanged(...) method of the chart-view is called.
This is especially important if viewport modifying methods are called on the chart
directly after... | export default abstract class ViewPortJob extends Poolable {
protected pts: number[] = new Array<number>(2);
protected mViewPortHandler: ViewPortHandler | null = null;
protected xValue: number = 0;
protected yValue: number = 0;
protected mTrans: Transformer | null = null;
protected view: Chart<ChartData<IDa... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class ViewPortJob extends AST#type_annotation#Left AST#primary_type#Left Poolable AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left protected pts : AST#type_annotation#Left AST#primary_type#... | export default abstract class ViewPortJob extends Poolable {
protected pts: number[] = new Array<number>(2);
protected mViewPortHandler: ViewPortHandler | null = null;
protected xValue: number = 0;
protected yValue: number = 0;
protected mTrans: Transformer | null = null;
protected view: Chart<ChartData<IDa... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/jobs/ViewPortJob.ets#L33-L59 | 8f68782ef7f44bbff5d95b688cb718790bac1686 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | mime_types/src/main/ets/Mime.ets | arkts | getIconFileByMIMEType | 根据MIME类型获取对应文件类型的图标
@param mimeType MIME类型名称 'text/css' | static getIconFileByMIMEType(mimeType: string): string {
const descriptor = Mime.getTypeDescriptorByMIMEType(mimeType);
return descriptor.iconFile;
} | AST#method_declaration#Left static getIconFileByMIMEType AST#parameter_list#Left ( AST#parameter#Left mimeType : 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 A... | static getIconFileByMIMEType(mimeType: string): string {
const descriptor = Mime.getTypeDescriptorByMIMEType(mimeType);
return descriptor.iconFile;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/mime_types/src/main/ets/Mime.ets#L92-L95 | 204d84368a732008965ee536ed329c1629a8dfdb | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/NavigationPage.ets | arkts | NavigationContent | 导航页面内容视图
@returns {void} 无返回值 | @Builder
private NavigationContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
if (this.vm.hasResult) {
this.ResultSection();
SpaceVerticalLarge();
}
IBestCellGroup({ inset: true, outerMargin: 0 }) {
ForEach(this.vm.cards, (it... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private NavigationContent 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_co... | @Builder
private NavigationContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
if (this.vm.hasResult) {
this.ResultSection();
SpaceVerticalLarge();
}
IBestCellGroup({ inset: true, outerMargin: 0 }) {
ForEach(this.vm.cards, (it... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/NavigationPage.ets#L47-L70 | 96b6103f54401ccfc5b35271760657c0c7ba7828 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verifycode/Index.ets | arkts | VerifyCodeViewComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { VerifyCodeViewComponent } from './src/main/ets/view/VerifyCodeView'; | AST#export_declaration#Left export { VerifyCodeViewComponent } from './src/main/ets/view/VerifyCodeView' ; AST#export_declaration#Right | export { VerifyCodeViewComponent } from './src/main/ets/view/VerifyCodeView'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verifycode/Index.ets#L15-L15 | 38651f5821ec9f28c506df2396d3cbda791e08dc | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets | arkts | refundOrder | 申请订单退款
@param {RefundOrderRequest} params - 退款请求参数
@returns {Promise<NetworkResponse<boolean>>} 是否成功 | async refundOrder(params: RefundOrderRequest): Promise<NetworkResponse<boolean>> {
const resp: AxiosResponse<NetworkResponse<boolean>> =
await NetworkClient.http.post("order/info/refund", params);
return resp.data;
} | AST#method_declaration#Left async refundOrder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left RefundOrderRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener... | async refundOrder(params: RefundOrderRequest): Promise<NetworkResponse<boolean>> {
const resp: AxiosResponse<NetworkResponse<boolean>> =
await NetworkClient.http.post("order/info/refund", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L49-L53 | 151e793d78ab1572ea1c72cd6105028eea662d85 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ImageUtils.ets | arkts | 修改HSV格式的颜色值,可根据业务需求或者UI设计自行修改S和V的值,此处只举例进行说明
@param color HSV格式的颜色 | export function modifySVValue(color: ColorHsv): void {
if (color.hue > 0 && color.hue <= 60) {
color.saturation = 0.12;
color.value = 0.93;
} else if (color.hue > 60 && color.hue <= 190) {
color.saturation = 0.08;
color.value = 0.91;
} else if (color.hue > 190 && color.hue <= 270) {
color.satu... | AST#export_declaration#Left export AST#function_declaration#Left function modifySVValue AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left ColorHsv AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ... | export function modifySVValue(color: ColorHsv): void {
if (color.hue > 0 && color.hue <= 60) {
color.saturation = 0.12;
color.value = 0.93;
} else if (color.hue > 60 && color.hue <= 190) {
color.saturation = 0.08;
color.value = 0.91;
} else if (color.hue > 190 && color.hue <= 270) {
color.satu... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ImageUtils.ets#L74-L88 | fa878bd0f957cbb7e279d3688e81e0fc29dccb55 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/common/FeedbackService.ets | arkts | showLoading | 显示加载提示 | async showLoading(options: LoadingOptions): Promise<string> {
const loadingId = this.generateId();
this.currentLoadingId = loadingId;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Loading started: ${options.message}`);
// 显示加载Toast
await promptAction.showToast({
message: `⏳ ${op... | AST#method_declaration#Left async showLoading AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left LoadingOptions 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_... | async showLoading(options: LoadingOptions): Promise<string> {
const loadingId = this.generateId();
this.currentLoadingId = loadingId;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Loading started: ${options.message}`);
await promptAction.showToast({
message: `⏳ ${options.messag... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/FeedbackService.ets#L95-L108 | 77dc38a60397b5d05ce8585c5966b6540988bf42 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/huawei/HwSubscriber.ets | arkts | queryProducts | 查询产品信息 | async queryProducts(): Promise<iap.Product[] | null> {
const productIds: string[] = [
HwSubscribeConstants.SKU_1,
HwSubscribeConstants.SKU_2,
HwSubscribeConstants.SKU_3
];
const param: iap.QueryProductsParameter = {
productType : iap.ProductType.AUTORENEWABLE,
productIds : pr... | AST#method_declaration#Left async queryProducts 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#qualified_type#Left iap . Product AST#quali... | async queryProducts(): Promise<iap.Product[] | null> {
const productIds: string[] = [
HwSubscribeConstants.SKU_1,
HwSubscribeConstants.SKU_2,
HwSubscribeConstants.SKU_3
];
const param: iap.QueryProductsParameter = {
productType : iap.ProductType.AUTORENEWABLE,
productIds : pr... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/HwSubscriber.ets#L51-L72 | 63e8e11d3be5327293a40e068bb5c326d35d02e1 | github |
mhtcgr/ToDoList_For_Harmony.git | 356d4c9a507205f02870e970203022a380c8a2a1 | entry/src/main/ets/pages/TodoPage.ets | arkts | markTodoAsFinished | 标记待办事项为完成 | markTodoAsFinished(index: number) {
const todo = this.todosUnfinished[index];
todo.isFinished = true;
this.todosUnfinished = this.todos.filter(todo => !todo.isFinished);
this.todosFinished = this.todos.filter(todo => todo.isFinished);
this.model.ToDoData = this.todos;
this.model.saveTodos();
} | AST#method_declaration#Left markTodoAsFinished 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#block_statement#Left { AST#statement#Left AST#variable_declaration... | markTodoAsFinished(index: number) {
const todo = this.todosUnfinished[index];
todo.isFinished = true;
this.todosUnfinished = this.todos.filter(todo => !todo.isFinished);
this.todosFinished = this.todos.filter(todo => todo.isFinished);
this.model.ToDoData = this.todos;
this.model.saveTodos();
} | https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/pages/TodoPage.ets#L96-L103 | 581de9a9392a044125d310c0a05480b558394237 | github |
htliang128/arkts_oss.git | 9da4a87c36272873c649f556854bd793ac337a18 | htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets | arkts | getMaxLimit | Getter and setter for maxLimit | getMaxLimit(): number | undefined {
return this.maxLimit;
} | AST#method_declaration#Left getMaxLimit AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number 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... | getMaxLimit(): number | undefined {
return this.maxLimit;
} | https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L173-L175 | f92488e03e9f961944e86334f9e8153d524967e4 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets | arkts | sign | 签名
@param str 需要签名的字符串
@param priKey 私钥
@returns string> 签名对象 | static async sign(str: string, priKey: string): Promise<string> {
return CryptoUtil.sign(str, priKey, 'SM2_256', 'SM2_256|SM3', 256);
} | AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static async sign(str: string, priKey: string): Promise<string> {
return CryptoUtil.sign(str, priKey, 'SM2_256', 'SM2_256|SM3', 256);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L60-L62 | 20bf74d46164d67a5e507d75cf1117ffeb135399 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | getDayName | 获取日期名称 | private getDayName(day: number): string {
return LunarUtils.getDayName(day);
} | AST#method_declaration#Left private getDayName 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... | private getDayName(day: number): string {
return LunarUtils.getDayName(day);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L651-L653 | b8a732d427332e8d01c3c8d23ccffee3f73d8386 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ar/ARCardService.ets | arkts | AR模型接口 | export interface ARModel {
id: string;
name: string;
type: ModelType;
filePath: string;
texture?: string;
animations: ModelAnimation[];
physics: PhysicsConfig;
transform: Transform3D;
metadata: Record<string, any>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ARModel 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 name : AST#type_annotation#Left AST#pri... | export interface ARModel {
id: string;
name: string;
type: ModelType;
filePath: string;
texture?: string;
animations: ModelAnimation[];
physics: PhysicsConfig;
transform: Transform3D;
metadata: Record<string, any>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L97-L107 | cb5e029e6705c7ace570876634d2e55a4aeee18b | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/navigation/UserGraph.ets | arkts | @file 用户模块导航图
@author Joker.X | export class UserGraph implements RouteGraph {
/**
* 注册用户模块导航路由
*/
register(): void {
RouteBuild.register(UserRoutes.Profile, wrapBuilder(ProfileNav));
RouteBuild.register(UserRoutes.AddressList, wrapBuilder(AddressListNav));
RouteBuild.register(UserRoutes.AddressDetail, wrapBuilder(AddressDetailN... | AST#export_declaration#Left export AST#class_declaration#Left class UserGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /**
* 注册用户模块导航路由
*/ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left ... | export class UserGraph implements RouteGraph {
register(): void {
RouteBuild.register(UserRoutes.Profile, wrapBuilder(ProfileNav));
RouteBuild.register(UserRoutes.AddressList, wrapBuilder(AddressListNav));
RouteBuild.register(UserRoutes.AddressDetail, wrapBuilder(AddressDetailNav));
RouteBuild.regi... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/navigation/UserGraph.ets#L12-L22 | eed51c86f6f0a782864acaa4cf0cec3c1f970a9c | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | setUseOnlineData | 设置是否使用联网数据
@param useOnline 是否使用联网数据 | setUseOnlineData(useOnline: boolean): void {
this.useOnlineData = useOnline;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Online lunar data ${useOnline ? 'enabled' : 'disabled'}`);
} | AST#method_declaration#Left setUseOnlineData AST#parameter_list#Left ( AST#parameter#Left useOnline : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | setUseOnlineData(useOnline: boolean): void {
this.useOnlineData = useOnline;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Online lunar data ${useOnline ? 'enabled' : 'disabled'}`);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L409-L412 | 558c24964d36950f5f8080a4339d349928f69464 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets | arkts | packing | packing压缩
@param sourcePixelMap 原始待压缩图片的PixelMap
@param imageQuality 图片质量参数
@param packingFormat 目标格式。当前只支持"image/jpeg"、"image/webp" 和 "image/png"
@returns data 返回压缩后的图片数据 | async packing(sourcePixelMap: image.PixelMap, imageQuality: number, packingFormat: string): Promise<ArrayBuffer> {
const imagePackerApi = image.createImagePacker();
const packOpts: image.PackingOption = { format: 'image/' + packingFormat, quality: imageQuality };
const data: ArrayBuffer = await imagePackerA... | AST#method_declaration#Left async packing AST#parameter_list#Left ( AST#parameter#Left sourcePixelMap : 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#Left imageQuality ... | async packing(sourcePixelMap: image.PixelMap, imageQuality: number, packingFormat: string): Promise<ArrayBuffer> {
const imagePackerApi = image.createImagePacker();
const packOpts: image.PackingOption = { format: 'image/' + packingFormat, quality: imageQuality };
const data: ArrayBuffer = await imagePackerA... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L388-L393 | 0258425e4f101f0a7f43b2e0a34fd9273556d26a | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets | arkts | resetAxisMaximum | By calling this method, any custom maximum value that has been previously set is reseted,
and the calculation is
done automatically. | public resetAxisMaximum(): void {
this.mCustomAxisMax = false;
} | AST#method_declaration#Left public resetAxisMaximum 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#Lef... | public resetAxisMaximum(): void {
this.mCustomAxisMax = false;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L670-L672 | 3de5dc5be8d0b21256d8e77b574f78544a625f98 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/return_value_passing/return_value_passing_002_F.ets | arkts | Introduction 返回值传递 | export function return_value_passing_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
let t = f(_clean);
taint.Sink(t);
} | AST#export_declaration#Left export AST#function_declaration#Left function return_value_passing_002_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_st... | export function return_value_passing_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
let t = f(_clean);
taint.Sink(t);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/return_value_passing/return_value_passing_002_F.ets#L6-L11 | 683fa4f27864db8575d1b47bd2230e8f4a2e0aa1 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets | arkts | [End session_backup] | export async function sessionBackup(): Promise<void> {
gSession = createSessionBackup();
// 此处可根据backup.getLocalCapabilities()提供的能力文件,选择需要备份的应用
// 也可直接根据应用包名称进行备份
const backupApps: string[] = [
'com.samples.filebackupextension',
]
await gSession.appendBundles(backupApps);
Logger.info('appendBundles su... | AST#export_declaration#Left export AST#function_declaration#Left async function sessionBackup 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... | export async function sessionBackup(): Promise<void> {
gSession = createSessionBackup();
const backupApps: string[] = [
'com.samples.filebackupextension',
]
await gSession.appendBundles(backupApps);
Logger.info('appendBundles success');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets#L134-L143 | 0b6d5b1b5f38247578e191f6fe7525593aae1df3 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/Poolable.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, soft... | export abstract class Poolable {
public static NO_OWNER = -1;
public currentOwnerId = Poolable.NO_OWNER;
abstract instantiate(): Poolable;
} | AST#export_declaration#Left export AST#class_declaration#Left abstract class Poolable AST#class_body#Left { AST#property_declaration#Left public static NO_OWNER = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_dec... | export abstract class Poolable {
public static NO_OWNER = -1;
public currentOwnerId = Poolable.NO_OWNER;
abstract instantiate(): Poolable;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Poolable.ets#L16-L21 | 7dd3c15c8ae730031b386886b34f9bc62368411d | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Chip.d.ets | arkts | Defines chip symbolglyph options.
@interface ChipSymbolGlyphOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export interface ChipSymbolGlyphOptions {
/**
* Symbol normal.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
normal?: SymbolGlyphModifier;
/**
* Symbol activated.
*
* @type { ?SymbolGlyphModifier }
* @syscap System... | AST#export_declaration#Left export AST#interface_declaration#Left interface ChipSymbolGlyphOptions AST#object_type#Left { /**
* Symbol normal.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left normal ? : AST#type_anno... | export interface ChipSymbolGlyphOptions {
normal?: SymbolGlyphModifier;
activated?: SymbolGlyphModifier;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L370-L391 | 2a4a3f88541f0d8f7998f6e99eee41ab90dd0de8 | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/BorderImageSample/entry/src/main/ets/common/util/StringUtil.ets | arkts | String Util for all features. | export class StringUtil {
/**
* Numbers turn into percentages.
*
* @param figure , postice number;
* @return {string} percentage.
*/
public static numberToPercentage(figure: number): string {
return figure + '%';
}
} | AST#export_declaration#Left export AST#class_declaration#Left class StringUtil AST#class_body#Left { /**
* Numbers turn into percentages.
*
* @param figure , postice number;
* @return {string} percentage.
*/ AST#method_declaration#Left public static numberToPercentage AST#parameter_list#Left ( AST#parame... | export class StringUtil {
public static numberToPercentage(figure: number): string {
return figure + '%';
}
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BorderImageSample/entry/src/main/ets/common/util/StringUtil.ets#L19-L30 | 30d61c7701c7c2c9046daf1af6f2908b6b329f19 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/notification/NotificationUtil.ets | arkts | 获取指定类型的通知渠道
@param {notificationManager.SlotType} type 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。
@returns {Promise<notificationManager.NotificationSlot>} 返回通知渠道对象。 | export async function get(type: notificationManager.SlotType): Promise<notificationManager.NotificationSlot> {
return notificationManager.getSlot(type);
} | AST#export_declaration#Left export AST#function_declaration#Left async function get AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#para... | export async function get(type: notificationManager.SlotType): Promise<notificationManager.NotificationSlot> {
return notificationManager.getSlot(type);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L382-L384 | aad863d61735f4aa927e4176479a0c3f326f5584 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets | arkts | getFaultMessage | 获取数据异常信息
@param faultMessage 异常信息集合 | public static async getFaultMessage(faultDataSource: FaultDataSource): Promise<void> {
logger.info(`getFaultMessage start`);
try {
// TODO:知识点:通过dataPreferencesManager.get方法获取异常信息数据
const data: dataPreferences.ValueType = await dataPreferencesManager.get('faultMessage', []);
if (typeof data ==... | AST#method_declaration#Left public static async getFaultMessage AST#parameter_list#Left ( AST#parameter#Left faultDataSource : AST#type_annotation#Left AST#primary_type#Left FaultDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pri... | public static async getFaultMessage(faultDataSource: FaultDataSource): Promise<void> {
logger.info(`getFaultMessage start`);
try {
const data: dataPreferences.ValueType = await dataPreferencesManager.get('faultMessage', []);
if (typeof data === 'string') {
const faultData: Array<strin... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets#L68-L86 | 7b2414dfeb6bf234eba29cf4ec0b82f4296cfdf5 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/SwipeGesture.ets | arkts | Swipe | [Start catch_swipe_gesture_event] | @Entry
@Component
export struct Swipe {
@State rotateAngle: number = 0;
@State speed: number = 1;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Column() {
Text('SwipeGesture speed\n' + this.speed)
Text('SwipeGesture angle\n' + this.rotateAngle... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Swipe AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right rotateAngle : AST#type_annotation#Left AST#primary_type#Left ... | @Entry
@Component
export struct Swipe {
@State rotateAngle: number = 0;
@State speed: number = 1;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Column() {
Text('SwipeGesture speed\n' + this.speed)
Text('SwipeGesture angle\n' + this.rotateAngle... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/SwipeGesture.ets#L17-L57 | 6df4bcecaec39bf77f3b933ea7deaa540afa2d4d | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/XAxis.ets | arkts | setDrawCustomLabels | 设置是否使用自定义Labels
@param flag 是否使用自定义Labels | public setDrawCustomLabels(flag: boolean): void {
this.mUseCustomLabels = flag;
} | AST#method_declaration#Left public setDrawCustomLabels AST#parameter_list#Left ( AST#parameter#Left flag : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prim... | public setDrawCustomLabels(flag: boolean): void {
this.mUseCustomLabels = flag;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L203-L205 | 9ef1c258c47e7d71f792d413bf4e7bbf4026f161 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/MessagePageRequest.ets | arkts | @file 分页查询消息请求
@author Joker.X | export class MessagePageRequest {
/**
* 会话ID
*/
sessionId?: number;
/**
* 页码
*/
page: number = 1;
/**
* 每页大小
*/
size: number = 20;
/**
* 排序字段
*/
order: string = "createTime";
/**
* 排序方式:"asc" 或 "desc"
*/
sort: string = "desc";
/**
* @param {Partial<MessagePageRequ... | AST#export_declaration#Left export AST#class_declaration#Left class MessagePageRequest AST#class_body#Left { /**
* 会话ID
*/ AST#property_declaration#Left sessionId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 页码... | export class MessagePageRequest {
sessionId?: number;
page: number = 1;
size: number = 20;
order: string = "createTime";
sort: string = "desc";
constructor(init?: Partial<MessagePageRequest>) {
if (!init) return;
this.sessionId = init.sessionId ?? this.sessionId;
this.page = i... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/MessagePageRequest.ets#L5-L38 | 279e5c55132214ea74bb3080101ac6102ecb8ff9 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/TLSEchoServer/entry/src/main/ets/pages/Index.ets | arkts | getTlsConnOptions | 获取tls监听配置信息 | getTlsConnOptions(): socket.TLSConnectOptions {
let listenAddress: socket.NetAddress = { address: '0.0.0.0', port: this.port }
let context = getContext(this)
let tlsSecOptions: socket.TLSSecureOptions = {
cert: copy2SandboxAndReadContent(context, this.certFileUri),
key: copy2SandboxAndReadConten... | AST#method_declaration#Left getTlsConnOptions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . TLSConnectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left A... | getTlsConnOptions(): socket.TLSConnectOptions {
let listenAddress: socket.NetAddress = { address: '0.0.0.0', port: this.port }
let context = getContext(this)
let tlsSecOptions: socket.TLSSecureOptions = {
cert: copy2SandboxAndReadContent(context, this.certFileUri),
key: copy2SandboxAndReadConten... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/TLSEchoServer/entry/src/main/ets/pages/Index.ets#L137-L146 | 81efb7ce1d61ec2dba92b9b3df781db4f6b41ac8 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets | arkts | createCanvas | 创建canvas 背景 和 凹槽 | createCanvas() {
if (this.circleInfo) {
this.context.reset()
CanvasCreateRectangle({
context: this.context,
tabsBgColor: this.tabsBgColor
})
CanvasClipGroove({
context: this.context,
menuLength: this.tabsMenu.length,
center: this.animationPositionX,
... | AST#method_declaration#Left createCanvas 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 . circleInfo AST#member_expression#Right AST#... | createCanvas() {
if (this.circleInfo) {
this.context.reset()
CanvasCreateRectangle({
context: this.context,
tabsBgColor: this.tabsBgColor
})
CanvasClipGroove({
context: this.context,
menuLength: this.tabsMenu.length,
center: this.animationPositionX,
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets#L111-L124 | 657e3a9a5f849825903fb794e768f131637766e6 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/search.ets | arkts | historySearch | ****************************************历史搜索 ********************************************// | @Builder
historySearch(){
Column({ space: 5 }) {
Row() {
Text('历史搜索').fontSize(20)
Image('/image/home/trash.png')
.width(20)
.height(20)
.margin({right:10})
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({left:10,top:5,... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right historySearch 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_param... | @Builder
historySearch(){
Column({ space: 5 }) {
Row() {
Text('历史搜索').fontSize(20)
Image('/image/home/trash.png')
.width(20)
.height(20)
.margin({right:10})
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({left:10,top:5,... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/search.ets#L65-L111 | f959958b24cbe5edddf4cd6ea5a42672ec4945a5 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoProcessBaseWeb/entry/src/main/ets/pages/Index.ets | arkts | onBackPress | [StartExclude index] [Start on_back_press] | onBackPress(): boolean | void {
if (this.isFullScreen && this.handler) {
this.handler.exitFullScreen();
return true;
}
return false;
} | AST#method_declaration#Left onBackPress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left void AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { A... | onBackPress(): boolean | void {
if (this.isFullScreen && this.handler) {
this.handler.exitFullScreen();
return true;
}
return false;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoProcessBaseWeb/entry/src/main/ets/pages/Index.ets#L128-L134 | c24113f2c77e0afe847b4e7ae859e86cf5c450a5 | gitee |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/ImageKnife.ets | arkts | cancel | 取消图片请求
@param request 图片请求request | cancel(request:ImageKnifeRequest) {
if (typeof request?.imageKnifeOption.loadSrc === 'string' && !request?.drawMainSuccess) {
emitter.emit(request.imageKnifeOption.loadSrc + request.componentId)
}
request.requestState = ImageKnifeRequestState.DESTROY
} | AST#method_declaration#Left cancel AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left ImageKnifeRequest 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_s... | cancel(request:ImageKnifeRequest) {
if (typeof request?.imageKnifeOption.loadSrc === 'string' && !request?.drawMainSuccess) {
emitter.emit(request.imageKnifeOption.loadSrc + request.componentId)
}
request.requestState = ImageKnifeRequestState.DESTROY
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L179-L184 | d6e74222679a63854054eebde3ff253c401fd68f | gitee |
2763981847/Accounting-app.git | cf8302a42588ecce1561b82e8533798157157257 | entry/src/main/ets/view/StatisticalCardComponent.ets | arkts | StatisticalCardComponent | 定义统计卡组件 | @Component
export default struct StatisticalCardComponent {
// 使用@Link和@Watch修饰属性,监视accounts属性的变化
@Link @Watch('onAccountsChange') accounts: Array<Account>;
// 使用@State修饰属性,声明一些状态变量
@State dayPay: number = dayStatistics(this.accounts, 0); // 今日支出
@State dayEarn: number = dayStatistics(this.accounts, 1); // 今... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct StatisticalCardComponent AST#component_body#Left { // 使用@Link和@Watch修饰属性,监视accounts属性的变化 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#... | @Component
export default struct StatisticalCardComponent {
@Link @Watch('onAccountsChange') accounts: Array<Account>;
@State dayPay: number = dayStatistics(this.accounts, 0);
@State dayEarn: number = dayStatistics(this.accounts, 1);
@State monthPay: number = monthStatistics(this.accounts, 0);
@Stat... | https://github.com/2763981847/Accounting-app.git/blob/cf8302a42588ecce1561b82e8533798157157257/entry/src/main/ets/view/StatisticalCardComponent.ets#L7-L97 | 97c24f5a116ca3627c0af51edfec1d51b09f7ac9 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BaseDataSet.ets | arkts | setColorsByList | ###### ###### COLOR SETTING RELATED METHODS ##### ######
Sets the colors that should be used fore this DataSet. Colors are reused
as soon as the number of Entries the DataSet represents is higher than
the size of the colors array. If you are using colors from the resources,
make sure that the colors are already prepa... | public setColorsByList(colors: JArrayList<Number>): void {
this.mColors = colors;
} | AST#method_declaration#Left public setColorsByList AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST#... | public setColorsByList(colors: JArrayList<Number>): void {
this.mColors = colors;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L147-L149 | 39d12c50828a43ff6a7804c862a227f11588a18c | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets | arkts | Pictures of banner. | export const PICTURE_BANNER: PictureItem[] = [
{ id: '1', name: '怒海', description: '怒海波涛', image: $r("app.media.ic_image1") },
{ id: '2', name: '大山深处', description: '大山深处感人的亲情之歌', image: $r("app.media.ic_image2") },
{ id: '3', name: '荒漠', description: '荒漠的亲情之歌', image: $r("app.media.ic_image3") }
]; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PICTURE_BANNER : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PictureItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST... | export const PICTURE_BANNER: PictureItem[] = [
{ id: '1', name: '怒海', description: '怒海波涛', image: $r("app.media.ic_image1") },
{ id: '2', name: '大山深处', description: '大山深处感人的亲情之歌', image: $r("app.media.ic_image2") },
{ id: '3', name: '荒漠', description: '荒漠的亲情之歌', image: $r("app.media.ic_image3") }
]; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets#L21-L25 | 6ccb3d5c49993a797d76de5821369ed19fbc2035 | gitee | |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/pages/MusicAuthorMusicListPage.ets | arkts | useMusicListByAuthorId | @description: 根据收藏夹id查询音乐列表
@date: 2024-07-16 23:39
@author wuwenqiang | useMusicListByAuthorId(){
getMusicListByAuthorIdService(this.musicAuthor!.authorId,this.pageNum,PAGE_SIZE).then((res) => {
this.musicList.push(...res.data);
this.total = res.total;
})
} | AST#method_declaration#Left useMusicListByAuthorId 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 getMusicListByAuthorIdService ( AST#expression#Left AST#member_expression#Left AST#expression#Left A... | useMusicListByAuthorId(){
getMusicListByAuthorIdService(this.musicAuthor!.authorId,this.pageNum,PAGE_SIZE).then((res) => {
this.musicList.push(...res.data);
this.total = res.total;
})
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/pages/MusicAuthorMusicListPage.ets#L41-L46 | bb4dbfaba5c811aa44fe0b8cdda3424b6659540a | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.router.d.ets | arkts | Define ParamsInterface.
@typedef { object } ParamsInterface
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 7
@deprecated since 8 | export type ParamsInterface = Record<string,Object>
/**
* Defines the Router interface.
*
* @syscap SystemCapability.ArkUI.ArkUI.Lite
* @since 3
* @deprecated since 8
* @useinstead ohos.router#router
*/
declare class Router {
/**
* Navigates to a specified page in the application based on the page URL and ... | AST#export_declaration#Left export AST#ERROR#Left type ParamsInterface = AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Object AST#primary... | export type ParamsInterface = Record<string,Object>
declare class Router {
static push(options: RouterOptions): void;
static replace(options: RouterOptions): void;
static back(options?: BackRouterOptions): void;
static getParams(): ParamsInterface;
static clear(): void;
static getLe... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L233-L332 | d08dd8f550c7a431e02c15457550fa45a1663557 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | deleteLearnTimes | MARK: - 数据操作和方法
清空学习次数 | async deleteLearnTimes(): Promise<void> {
this.allWords.forEach(word => {
word.learnTimes = 0;
});
await WordUserDbAccess.shared.clearLearnTimes()
} | AST#method_declaration#Left async deleteLearnTimes 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... | async deleteLearnTimes(): Promise<void> {
this.allWords.forEach(word => {
word.learnTimes = 0;
});
await WordUserDbAccess.shared.clearLearnTimes()
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L775-L780 | 3d048691b493e94e6da429dd72d4f09de7747f82 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/SubscribeManager.ets | arkts | 定义通知相关的常量 | export class SubscribeManagerNotification {
static readonly expireDateUpdated = "SubscribeManager.subscribeItem.expiresDateMs.updated"
} | AST#export_declaration#Left export AST#class_declaration#Left class SubscribeManagerNotification AST#class_body#Left { AST#property_declaration#Left static readonly expireDateUpdated = AST#expression#Left "SubscribeManager.subscribeItem.expiresDateMs.updated" AST#expression#Right AST#property_declaration#Right } AST#c... | export class SubscribeManagerNotification {
static readonly expireDateUpdated = "SubscribeManager.subscribeItem.expiresDateMs.updated"
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/SubscribeManager.ets#L18-L22 | 3d4b5f7b233355d8895478c8bc4256c03dc08b9c | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
ColumnSpaceAroundStart() { Text("A"); Text("B"); Text("C"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: HorizontalAlign.Start,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marg... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expressio... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: HorizontalAlign.Start,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marg... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L1164-L1179 | f52b15b1bc6fb6934390c60a55cabe92baff8d5e | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/SearchPage.ets | arkts | searchContacts | 搜索联系人 | private async searchContacts(keyword: string): Promise<Contact[]> {
if (this.activeTab === 'greetings') return [];
return await this.contactService.searchContacts({
keyword,
pageSize: 50
});
} | AST#method_declaration#Left private async searchContacts AST#parameter_list#Left ( AST#parameter#Left keyword : 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#gener... | private async searchContacts(keyword: string): Promise<Contact[]> {
if (this.activeTab === 'greetings') return [];
return await this.contactService.searchContacts({
keyword,
pageSize: 50
});
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L135-L142 | c8eeedecea3ed072b89cd8e770d0dd73b0c1b42d | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | addSysCodeEvent | 添加统一的系统框架级别编码拦截操作
@param codeEvent 系统级别编码操作事件 efRcpConfig.sysCodeEvent
@returns | addSysCodeEvent(codeEvent: efRcpConfig.sysCodeEvent): EfRcp {
if (this.cfg.interceptors) {
this.cfg.interceptors.push(new EfSysCodeInterceptor(codeEvent));
} else {
this.cfg.interceptors = [new EfSysCodeInterceptor(codeEvent)];
}
return this;
} | AST#method_declaration#Left addSysCodeEvent AST#parameter_list#Left ( AST#parameter#Left codeEvent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . sysCodeEvent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | addSysCodeEvent(codeEvent: efRcpConfig.sysCodeEvent): EfRcp {
if (this.cfg.interceptors) {
this.cfg.interceptors.push(new EfSysCodeInterceptor(codeEvent));
} else {
this.cfg.interceptors = [new EfSysCodeInterceptor(codeEvent)];
}
return this;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L222-L229 | 1369919b3b059ea964399a8d389f5ef9c12185e4 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactImportPage.ets | arkts | buildTabBar | 构建标签栏 | @Builder
buildTabBar() {
Row() {
this.buildTabItem('CSV格式', 0)
this.buildTabItem('JSON格式', 1)
this.buildTabItem('复制粘贴', 2)
}
.width('100%')
.height('50vp')
.backgroundColor('#ffffff')
.border({ width: { bottom: 1 }, color: '#e5e5e5' })
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBar 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#container_content_body#Left { AST#expression_state... | @Builder
buildTabBar() {
Row() {
this.buildTabItem('CSV格式', 0)
this.buildTabItem('JSON格式', 1)
this.buildTabItem('复制粘贴', 2)
}
.width('100%')
.height('50vp')
.backgroundColor('#ffffff')
.border({ width: { bottom: 1 }, color: '#e5e5e5' })
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L79-L90 | e6a0940240392a03a8a6fb68e23a1eda1e39e5b3 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/StorageUtils.ets | arkts | putString | 存储字符串数据
@param key 存储键
@param value 存储值 | static async putString(key: string, value: string): Promise<void> {
const dataPreferences = StorageUtils.dataPreferences;
if (!dataPreferences) {
console.error('Preferences not initialized');
return;
}
try {
await dataPreferences.put(key, value);
await dataPreferences.flush();
... | AST#method_declaration#Left static async putString 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 string AST#primary_... | static async putString(key: string, value: string): Promise<void> {
const dataPreferences = StorageUtils.dataPreferences;
if (!dataPreferences) {
console.error('Preferences not initialized');
return;
}
try {
await dataPreferences.put(key, value);
await dataPreferences.flush();
... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L24-L37 | 7c2bd80db64fee08e654d26b283521c8b36796bc | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/routermodule/src/main/ets/interceptor/Interceptor.ets | arkts | 定义拦截器方法 | export class Interceptor {
// 定义拦截器容器
private static list: Array<InterceptorExecute> = [];
/**
* 注册拦截页面
*
* @param interceptorFnc 子模块传过来的自定义拦截函数
*/
public static registerInterceptorPage(interceptorFnc: InterceptorExecute): void {
Interceptor.list.push(interceptorFnc);
}
/**
* 公共拦截器逻辑
... | AST#export_declaration#Left export AST#class_declaration#Left class Interceptor AST#class_body#Left { // 定义拦截器容器 AST#property_declaration#Left private static list : 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 Interce... | export class Interceptor {
private static list: Array<InterceptorExecute> = [];
public static registerInterceptorPage(interceptorFnc: InterceptorExecute): void {
Interceptor.list.push(interceptorFnc);
}
public static interceptor(appUri: string, param?: string): boolean {
for (let i = 0; ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/interceptor/Interceptor.ets#L42-L70 | 92c9f438c8abdac04ecd6b989af55cde4c42bece | gitee | |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/CloudDBService.ets | arkts | getUserPlayHistory | 获取用户的播放历史记录 | async getUserPlayHistory(userId: number): Promise<CloudDBZoneObject[]> {
try {
// 模拟获取播放历史
console.log(`获取用户播放历史,用户ID: ${userId}`);
const historyText = userId === 1001 ? "稻香,晴天,七里香" : "演员,绅士,意外";
const songTitles: string[] = historyText.split(',');
const songs: CloudDBZoneObject... | AST#method_declaration#Left async getUserPlayHistory AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty... | async getUserPlayHistory(userId: number): Promise<CloudDBZoneObject[]> {
try {
console.log(`获取用户播放历史,用户ID: ${userId}`);
const historyText = userId === 1001 ? "稻香,晴天,七里香" : "演员,绅士,意外";
const songTitles: string[] = historyText.split(',');
const songs: CloudDBZoneObject[] = songTi... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/CloudDBService.ets#L148-L171 | 5049542c9cdbfb7b3fffa817a9b13538b8aabbd6 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setCenterTextOffset | Sets the offset the center text should have from it's original position in vp. Default x = 0, y = 0
@param x
@param y | public setCenterTextOffset(x: number, y: number): void {
this.mCenterTextOffset.x = Utils.handleDataValues(x);
this.mCenterTextOffset.y = Utils.handleDataValues(y);
} | AST#method_declaration#Left public setCenterTextOffset AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | public setCenterTextOffset(x: number, y: number): void {
this.mCenterTextOffset.x = Utils.handleDataValues(x);
this.mCenterTextOffset.y = Utils.handleDataValues(y);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L593-L596 | e7520e6523c3362a7957d84a31e52d14846a8e0f | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/NetConnectionUtils.ets | arkts | hasDefaultNetSync | 检查默认数据网络是否被激活 | static hasDefaultNetSync(): boolean {
return connection.hasDefaultNetSync();
} | AST#method_declaration#Left static hasDefaultNetSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_... | static hasDefaultNetSync(): boolean {
return connection.hasDefaultNetSync();
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/NetConnectionUtils.ets#L27-L29 | 2037e84028cf07b7fc161b3023f8e8c978f502af | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/util/TimeTools.ets | arkts | 对视频数字进行整改
@param num 视频相关数字
@returns 未超过10数字前添加0,超过10未做整改 | export function fillNum(num: number) {
if (num < 10) {
return `0${num}`;
}
return num.toString();
} | AST#export_declaration#Left export AST#function_declaration#Left function fillNum AST#parameter_list#Left ( 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#block_statement#Left { AST#statem... | export function fillNum(num: number) {
if (num < 10) {
return `0${num}`;
}
return num.toString();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/util/TimeTools.ets#L21-L26 | 895d2ebb5d4293f0cd1c36f7b92a24d04199e61a | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets | arkts | clearAllCBooks | 清空所有 CBook,以便可以重新刷新 | public clearAllCBooks(): void {
this.cmetaInfoManager.clearAll((fileName) => {
this.removeBookDb(CMetaInfoHelper.baseName(fileName));
});
} | AST#method_declaration#Left public clearAllCBooks 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#ex... | public clearAllCBooks(): void {
this.cmetaInfoManager.clearAll((fileName) => {
this.removeBookDb(CMetaInfoHelper.baseName(fileName));
});
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets#L245-L249 | cbde55b18d22ef126300a5a41fdf81c806eb1a33 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/pages/LiveDetectionAndEncryptionPage.ets | arkts | encodeAndUpload | 模拟加密上传
@param encodeData 加密和上传的数据 | encodeAndUpload(encodeData: string) {
encryptMessagePromise(encodeData, cryptoFramework.CryptoMode.ENCRYPT_MODE)
.then((res) => {
let base = new util.Base64Helper();
// 获取到的uint8array转换成字符串
this.uploadContent = base.encodeToStringSync(res);
})
} | AST#method_declaration#Left encodeAndUpload AST#parameter_list#Left ( AST#parameter#Left encodeData : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_el... | encodeAndUpload(encodeData: string) {
encryptMessagePromise(encodeData, cryptoFramework.CryptoMode.ENCRYPT_MODE)
.then((res) => {
let base = new util.Base64Helper();
this.uploadContent = base.encodeToStringSync(res);
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/pages/LiveDetectionAndEncryptionPage.ets#L101-L108 | 263ad75666e3c368bce3945c7ea16739d27664d7 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets | arkts | Recent photo info
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 13 | export declare class RecentPhotoInfo {
/**
* The dateTaken of photos or videos
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/
dateTaken?: number;
/**
* The identifier of photos or videos
*
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class RecentPhotoInfo AST#class_body#Left { /**
* The dateTaken of photos or videos
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
*... | export declare class RecentPhotoInfo {
dateTaken?: number;
identifier?: string;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets#L141-L160 | 0d672d838ab00b6e3e0e156ca8ba1f03d4c68517 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.prompt.d.ets | arkts | Defines the response of ShowDialog.
@interface ShowDialogSuccessResponse
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 3
Defines the response of ShowDialog.
@interface ShowDialogSuccessResponse
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export interface ShowDialogSuccessResponse {
/**
* Defines the index of data.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 3
*/
/**
* Defines the index of data.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since... | AST#export_declaration#Left export AST#interface_declaration#Left interface ShowDialogSuccessResponse AST#object_type#Left { /**
* Defines the index of data.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 3
*/ /**
* Defines the index of data.
*
* @type { number }
... | export interface ShowDialogSuccessResponse {
index: number;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.prompt.d.ets#L130-L147 | 14c7e1bada8b0bc3b0072105e4ee5b1c58ca02f7 | gitee | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_commonAttrsLayout/ace_ets_module_commonAttrsLayout_nowear_api11/entry/src/main/ets/MainAbility/pages/comSizeAbility/WaterFlowDataSource.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class WaterFlowDataSource implements IDataSource {
private dataArray: number[] = []
private listeners: DataChangeListener[] = []
constructor | AST#export_declaration#Left export AST#ERROR#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_typ... | export class WaterFlowDataSource implements IDataSource {
private dataArray: number[] = []
private listeners: DataChangeListener[] = []
constructor | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_commonAttrsLayout/ace_ets_module_commonAttrsLayout_nowear_api11/entry/src/main/ets/MainAbility/pages/comSizeAbility/WaterFlowDataSource.ets#L15-L19 | b899246f97122fbea4e8a14568adc212967a06ff | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogCoreHandler.ets | arkts | openCustomDialog | 创建并弹出dialogContent对应的自定义弹窗
@param contentView 自定义弹窗中显示的组件内容。
@param options 弹窗样式。 | openCustomDialog<T extends IBaseDialogOptions>(contentView: WrappedBuilder<[T]>,
options: T): string {
if (!options.dialogId) {
options.dialogId = this.generateDialogId();
}
if (options.uiContext) {
this.openBaseCustomDialog(options.uiContext, contentView, options);
} else {
windo... | AST#method_declaration#Left openCustomDialog AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left IBaseDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left c... | openCustomDialog<T extends IBaseDialogOptions>(contentView: WrappedBuilder<[T]>,
options: T): string {
if (!options.dialogId) {
options.dialogId = this.generateDialogId();
}
if (options.uiContext) {
this.openBaseCustomDialog(options.uiContext, contentView, options);
} else {
windo... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogCoreHandler.ets#L37-L52 | 66629518d8697cda872aca7cacf5b9f14948d2a3 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/LoadingUtility.ets | arkts | hideLoading | =============================== 隐藏加载提示 =============================== | static hideLoading() {
if (LoadingUtility.loadingDialog) {
LoadingUtility.loadingDialog.close()
LoadingUtility.loadingDialog = null
}
} | AST#method_declaration#Left static hideLoading 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 LoadingUtility AST#expression#Right . loadingDialog AST#member_ex... | static hideLoading() {
if (LoadingUtility.loadingDialog) {
LoadingUtility.loadingDialog.close()
LoadingUtility.loadingDialog = null
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/LoadingUtility.ets#L30-L35 | 1e06517edd5a7d58ec0b4d36b418aa07d39ae256 | github |
huaweicloud/huaweicloud-iot-device-sdk-arkts.git | 72954bea19e7e7f93567487b036c0664457bdaf3 | huaweicloud_iot_device_library/src/main/ets/service/IService.ets | arkts | 服务接口类 | export interface IService {
/**
* 读属性回调
*
* @param fields 指定读取的字段名,不指定则读取全部可读字段
* @return 属性值,json格式
*/
onRead(fields?: string[]): object;
/**
* 写属性回调
*
* @param properties 属性期望值
* @return 操作结果jsonObject
*/
onWrite(properties: object): IotResult;
/**
* 命令回调
*
* @param ... | AST#export_declaration#Left export AST#interface_declaration#Left interface IService AST#object_type#Left { /**
* 读属性回调
*
* @param fields 指定读取的字段名,不指定则读取全部可读字段
* @return 属性值,json格式
*/ AST#type_member#Left onRead AST#parameter_list#Left ( AST#parameter#Left fields ? : AST#type_annotation#Left AST#primary_... | export interface IService {
onRead(fields?: string[]): object;
onWrite(properties: object): IotResult;
onCommand(command: Command): CommandRsp;
onEvent(deviceEvent: DeviceEvent): void;
} | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/IService.ets#L23-L54 | 793bd1f753eea20f9f810ba2752220d87fec77a0 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/vibrateeffect/src/main/ets/VibrateEffect.ets | arkts | aboutToAppear | UIContext实例对象 | aboutToAppear() {
this.uiContext = this.getUIContext?.();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiContext AST#member_expression#Righ... | aboutToAppear() {
this.uiContext = this.getUIContext?.();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/vibrateeffect/src/main/ets/VibrateEffect.ets#L43-L45 | f7a7cd77b0d993af90ee4c3297a21d6cfe072b23 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets | arkts | genTestOptionalDlpProperty | 生成可选参数的DLP策略 | async genTestOptionalDlpProperty(): Promise<dlpPermission.DLPProperty> {
let accountInfo = await this.getOsAccountInfo();
let property: dlpPermission.DLPProperty = {
'ownerAccount': accountInfo.distributedInfo.name,
'ownerAccountID': accountInfo.distributedInfo.id,
'ownerAccountType': dlpPermi... | AST#method_declaration#Left async genTestOptionalDlpProperty 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#qualified_type#Left dlpPermission . DLPProperty AS... | async genTestOptionalDlpProperty(): Promise<dlpPermission.DLPProperty> {
let accountInfo = await this.getOsAccountInfo();
let property: dlpPermission.DLPProperty = {
'ownerAccount': accountInfo.distributedInfo.name,
'ownerAccountID': accountInfo.distributedInfo.id,
'ownerAccountType': dlpPermi... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L155-L165 | 0e50d5fa48b7c069dd5834784283629c897adf35 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets | arkts | ArticleCardView | [EndExclude Case4] Article card component of the Explore module | @Component
export struct ArticleCardView {
// 3.Get the user information object userData on the ExploreArticleList card with the @StorageLink decorator
@StorageLink('userData') userData: UserData | null = null;
@Prop articleItem: LearningResource = new LearningResource();
// 4.Calculate whether the current art... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ArticleCardView AST#component_body#Left { // 3.Get the user information object userData on the ExploreArticleList card with the @StorageLink decorator AST#property_declaration#Left AST#decorator#Left @ StorageLink ( A... | @Component
export struct ArticleCardView {
@StorageLink('userData') userData: UserData | null = null;
@Prop articleItem: LearningResource = new LearningResource();
isCollected(): boolean {
return !!this.userData && this.userData.collectedIds.some((id: string) => id === this.articleItem.id);
}
h... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets#L76-L113 | ba79ecd8b861390acd7da44e7e6fa62c9f9bcfb7 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfBusinessCodeInterceptor.ets | arkts | intercept | 拦截器
@param context
@param next
@returns | async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise<rcp.Response> {
try {
//响应对象
const response = await next.handle(context);
//无监听则抛出异常
if (this.businessCodeEventListener) {
//设置监听
//1.将响应数据转换成json
if (response) {
let code = this... | AST#method_declaration#Left async intercept AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . RequestContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left next : AST#typ... | async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise<rcp.Response> {
try {
const response = await next.handle(context);
if (this.businessCodeEventListener) {
if (response) {
let code = this.businessCodeEventListener.businessCod... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfBusinessCodeInterceptor.ets#L43-L84 | de375a1c3a1446099007bdf04dabaf8d9a25c7ae | gitee |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/view/AddDialogComponent.ets | arkts | 声明一个 CustomDialog,用于创建自定义对话框组件 | @CustomDialog
export default struct AddDialogComponent {
controller?: CustomDialogController; // 对话框控制器
@Link isInsert: boolean; // 是否插入新记录的标志
@Link newAccount: Account; // 新账户的数据
confirm?: (isInsert: boolean, newAccount: Account) => void; // 确认操作的回调函数
private scroller: Scroller = new Scroller(); // 滚动器实例
p... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default AST#ERROR#Left struct AddDialogComponent { AST#property_declaration#Left controller ? : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right ; AST#... | @CustomDialog
export default struct AddDialogComponent {
controller?: CustomDialogController;
@Link isInsert: boolean;
@Link newAccount: Account;
confirm?: (isInsert: boolean, newAccount: Account) => void;
private scroller: Scroller = new Scroller();
private inputAmount = '';
private inputDesc = '';... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/AddDialogComponent.ets#L10-L106 | b665c65dda8e0291a8e6f5da84c3b1ee29b5d9a5 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets | arkts | submitPost | 提交帖子 | async submitPost(): Promise<void> {
try {
// 检查用户是否已登录
if (!this.userSession.isLoggedIn()) {
const toastOpts: ToastOptions = {
message: '请先登录后再发布',
duration: 2000
};
promptAction.showToast(toastOpts);
// 跳转到登录页面
router.pushUrl({
url:... | AST#method_declaration#Left async submitPost 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_argum... | async submitPost(): Promise<void> {
try {
if (!this.userSession.isLoggedIn()) {
const toastOpts: ToastOptions = {
message: '请先登录后再发布',
duration: 2000
};
promptAction.showToast(toastOpts);
router.pushUrl({
url: 'pages/user/LoginPage... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets#L149-L288 | 8457be2941c951b6256d5506af2d036afc8438c2 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.