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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
|
arkts
|
endImageDrag
|
End drag image.
|
private endImageDrag(): void {
let crop = this.cropShow.getCropRect();
let points = MathUtils.rectToPoints(crop);
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let angle = -(this.rotationAngle * tX * tY + this.sliderAngle);
let displayCenter = new Point(this.displayWidth / 2, this.displayHeight / 2);
let rotated = MathUtils.rotatePoints(points, angle, displayCenter);
let flipImage = this.cropShow.getCurrentFlipImage();
let offsets = MathUtils.fixImageMove(rotated, flipImage);
let image = this.cropShow.getImageRect();
image.move(offsets[0] * tX, offsets[1] * tY);
this.cropShow.setImageRect(image);
}
|
AST#method_declaration#Left private endImageDrag AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left crop = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cropShow AST#member_expression#Right AST#expression#Right . getCropRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left points = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MathUtils AST#expression#Right . rectToPoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left crop AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tX = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipHorizontal AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tY = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipVertically AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left angle = AST#expression#Left AST#unary_expression#Left - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rotationAngle AST#member_expression#Right AST#expression#Right * AST#expression#Left tX AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left tY AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . sliderAngle AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left displayCenter = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Point AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayHeight AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rotated = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MathUtils AST#expression#Right . rotatePoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left points AST#expression#Right , AST#expression#Left angle AST#expression#Right , AST#expression#Left displayCenter AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left flipImage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cropShow AST#member_expression#Right AST#expression#Right . getCurrentFlipImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offsets = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MathUtils AST#expression#Right . fixImageMove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rotated AST#expression#Right , AST#expression#Left flipImage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left image = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cropShow AST#member_expression#Right AST#expression#Right . getImageRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left offsets AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right * AST#expression#Left tX AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left offsets AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right * AST#expression#Left tY AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cropShow AST#member_expression#Right AST#expression#Right . setImageRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left image AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private endImageDrag(): void {
let crop = this.cropShow.getCropRect();
let points = MathUtils.rectToPoints(crop);
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let angle = -(this.rotationAngle * tX * tY + this.sliderAngle);
let displayCenter = new Point(this.displayWidth / 2, this.displayHeight / 2);
let rotated = MathUtils.rotatePoints(points, angle, displayCenter);
let flipImage = this.cropShow.getCurrentFlipImage();
let offsets = MathUtils.fixImageMove(rotated, flipImage);
let image = this.cropShow.getImageRect();
image.move(offsets[0] * tX, offsets[1] * tY);
this.cropShow.setImageRect(image);
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L526-L540
|
3785d0d6fda811613fc30b823c1ae8e8ad1a16ae
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
|
arkts
|
generateCryptoKey
|
生成非对称密钥
@param symAlgName 秘钥规格
@returns 指定秘钥规格的非对称公私
@param resultCoding 生成非对称秘钥的编码方式(hex/base64)
|
static generateCryptoKey(symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<CryptoKey> {
// 创建非对称密钥生成器
let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName);
// 通过非对称密钥生成器,随机生成非对称密钥
let promiseKeyPair = rsaGenerator.generateKeyPairSync();
// 转换成可以读懂的公私钥字符串
let pubKey = StrAndUintUtil.unitArray2StrCoding(promiseKeyPair.pubKey.getEncoded().data, resultCoding);
let priKey = StrAndUintUtil.unitArray2StrCoding(promiseKeyPair.priKey.getEncoded().data, resultCoding);
return OutDTO.OKByDataRow<CryptoKey>('生成' + symAlgName + '公私钥成功~', new CryptoKey(pubKey, priKey));
}
|
AST#method_declaration#Left static generateCryptoKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CryptoKey AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 创建非对称密钥生成器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rsaGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symAlgName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通过非对称密钥生成器,随机生成非对称密钥 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left promiseKeyPair = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rsaGenerator AST#expression#Right . generateKeyPairSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 转换成可以读懂的公私钥字符串 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pubKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2StrCoding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promiseKeyPair AST#expression#Right . pubKey AST#member_expression#Right AST#expression#Right . getEncoded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left priKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2StrCoding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promiseKeyPair AST#expression#Right . priKey AST#member_expression#Right AST#expression#Right . getEncoded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OKByDataRow AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CryptoKey AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '生成' AST#expression#Right + AST#expression#Left symAlgName AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '公私钥成功~' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CryptoKey AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left priKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static generateCryptoKey(symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<CryptoKey> {
let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName);
let promiseKeyPair = rsaGenerator.generateKeyPairSync();
let pubKey = StrAndUintUtil.unitArray2StrCoding(promiseKeyPair.pubKey.getEncoded().data, resultCoding);
let priKey = StrAndUintUtil.unitArray2StrCoding(promiseKeyPair.priKey.getEncoded().data, resultCoding);
return OutDTO.OKByDataRow<CryptoKey>('生成' + symAlgName + '公私钥成功~', new CryptoKey(pubKey, priKey));
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L137-L146
|
13fd702c57b2c7ab01f7911965dfb6eda7169bac
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets
|
arkts
|
deleteGridItem
|
删除gridItem
@param item 网格元素
@param itemAreaWidth 网格区域宽度
|
deleteGridItem(item: T, itemAreaWidth: number): void {
const index: number = this.gridData.indexOf(item);
animateTo({
curve: Curve.Friction, duration: DELETE_ANIMATION_DURATION, onFinish: () => {
// 初始化偏移位置
this.modifier.forEach((item) => {
item.offsetX = 0;
item.offsetY = 0;
})
// 删除对应的数据
this.gridData.splice(index, 1);
this.modifier.splice(index, 1);
this.status = DeletionStatus.FINISH;
// 存储动画状态
AppStorage.setOrCreate('deletionStatus', this.status);
}
}, () => {
// TODO:知识点:实现删除动画。先让目标元素的opacity为0,不可视,直接删除目标元素会导致偏移的时候位置异常,接着遍历元素的属性对象,修改偏移量。
this.modifier[index].opacity = 0;
this.modifier.forEach((item: GridItemModifier, ind: number) => {
// 最后一条数据不执行偏移
if (index === this.gridData.length - 1) {
this.status = DeletionStatus.START;
return;
}
if (ind > index && ind % COLUMN_COUNT !== 0) {
item.offsetX = -itemAreaWidth;
} else if (ind > index && ind % COLUMN_COUNT === 0) {
item.offsetX = itemAreaWidth * 4; // 位置偏移到上一行的最后一列,因此偏移4个gridItem所占的宽度
item.offsetY = -GRID_ITEM_SIZE;
}
})
this.status = DeletionStatus.START;
})
}
|
AST#method_declaration#Left deleteGridItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left itemAreaWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . gridData AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Friction AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left DELETE_ANIMATION_DURATION AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFinish AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 初始化偏移位置 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . modifier AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . offsetY AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 删除对应的数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . gridData AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . modifier AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left DeletionStatus AST#expression#Right . FINISH AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 存储动画状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'deletionStatus' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // TODO:知识点:实现删除动画。先让目标元素的opacity为0,不可视,直接删除目标元素会导致偏移的时候位置异常,接着遍历元素的属性对象,修改偏移量。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . modifier AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . opacity AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . modifier AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left GridItemModifier AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ind : 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . gridData AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left DeletionStatus AST#expression#Right . START AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ind AST#expression#Right > AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ind AST#expression#Right % AST#expression#Left COLUMN_COUNT AST#expression#Right AST#binary_expression#Right AST#expression#Right !== AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left itemAreaWidth AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ind AST#expression#Right > AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ind AST#expression#Right % AST#expression#Left COLUMN_COUNT AST#expression#Right AST#binary_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left itemAreaWidth AST#expression#Right * AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 位置偏移到上一行的最后一列,因此偏移4个gridItem所占的宽度 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . offsetY AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left GRID_ITEM_SIZE AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left DeletionStatus AST#expression#Right . START AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
deleteGridItem(item: T, itemAreaWidth: number): void {
const index: number = this.gridData.indexOf(item);
animateTo({
curve: Curve.Friction, duration: DELETE_ANIMATION_DURATION, onFinish: () => {
this.modifier.forEach((item) => {
item.offsetX = 0;
item.offsetY = 0;
})
this.gridData.splice(index, 1);
this.modifier.splice(index, 1);
this.status = DeletionStatus.FINISH;
AppStorage.setOrCreate('deletionStatus', this.status);
}
}, () => {
this.modifier[index].opacity = 0;
this.modifier.forEach((item: GridItemModifier, ind: number) => {
if (index === this.gridData.length - 1) {
this.status = DeletionStatus.START;
return;
}
if (ind > index && ind % COLUMN_COUNT !== 0) {
item.offsetX = -itemAreaWidth;
} else if (ind > index && ind % COLUMN_COUNT === 0) {
item.offsetX = itemAreaWidth * 4;
item.offsetY = -GRID_ITEM_SIZE;
}
})
this.status = DeletionStatus.START;
})
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets#L74-L108
|
0ec15089d8d0933c67af7872c16294f111ed377e
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ComponentReuse/entry/src/main/ets/common/Constants.ets
|
arkts
|
Common constants for all features
|
export class Constants {
/**
* Default List Interval.
*/
public static readonly LIST_SPACE: number = 12;
/**
* Maximum width.
*/
public static readonly LAYOUT_MAX: string = '100%';
/**
* Common initialization.
*/
public static readonly COMM_INIT: number = 0;
/**
* NavDestination item0.
*/
public static readonly NAV_DESTINATION_ITEM_0: string = 'NavDestination_item_0';
/**
* NavDestination item1.
*/
public static readonly NAV_DESTINATION_ITEM_1: string = 'NavDestination_item_1';
/**
* NavDestination item2.
*/
public static readonly NAV_DESTINATION_ITEM_2: string = 'NavDestination_item_2';
/**
* NavDestination item3.
*/
public static readonly NAV_DESTINATION_ITEM_3: string = 'NavDestination_item_3';
/**
* NavDestinationItem
*/
public static readonly NavDestinationData: NavDestinationItem[] = [
{
id: Constants.NAV_DESTINATION_ITEM_0, detail: $r('app.string.nav_destination_item0')
},
{
id: Constants.NAV_DESTINATION_ITEM_1, detail: $r('app.string.nav_destination_item1')
},
{
id: Constants.NAV_DESTINATION_ITEM_2, detail: $r('app.string.nav_destination_item2')
},
{
id: Constants.NAV_DESTINATION_ITEM_3, detail: $r('app.string.nav_destination_item3')
},
];
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { /**
* Default List Interval.
*/ AST#property_declaration#Left public static readonly LIST_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right /**
* Maximum width.
*/ AST#property_declaration#Left public static readonly LAYOUT_MAX : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /**
* Common initialization.
*/ AST#property_declaration#Left public static readonly COMM_INIT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /**
* NavDestination item0.
*/ AST#property_declaration#Left public static readonly NAV_DESTINATION_ITEM_0 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'NavDestination_item_0' AST#expression#Right ; AST#property_declaration#Right /**
* NavDestination item1.
*/ AST#property_declaration#Left public static readonly NAV_DESTINATION_ITEM_1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'NavDestination_item_1' AST#expression#Right ; AST#property_declaration#Right /**
* NavDestination item2.
*/ AST#property_declaration#Left public static readonly NAV_DESTINATION_ITEM_2 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'NavDestination_item_2' AST#expression#Right ; AST#property_declaration#Right /**
* NavDestination item3.
*/ AST#property_declaration#Left public static readonly NAV_DESTINATION_ITEM_3 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'NavDestination_item_3' AST#expression#Right ; AST#property_declaration#Right /**
* NavDestinationItem
*/ AST#property_declaration#Left public static readonly NavDestinationData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NavDestinationItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . NAV_DESTINATION_ITEM_0 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left detail AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nav_destination_item0' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . NAV_DESTINATION_ITEM_1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left detail AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nav_destination_item1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . NAV_DESTINATION_ITEM_2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left detail AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nav_destination_item2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . NAV_DESTINATION_ITEM_3 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left detail AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.nav_destination_item3' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Constants {
public static readonly LIST_SPACE: number = 12;
public static readonly LAYOUT_MAX: string = '100%';
public static readonly COMM_INIT: number = 0;
public static readonly NAV_DESTINATION_ITEM_0: string = 'NavDestination_item_0';
public static readonly NAV_DESTINATION_ITEM_1: string = 'NavDestination_item_1';
public static readonly NAV_DESTINATION_ITEM_2: string = 'NavDestination_item_2';
public static readonly NAV_DESTINATION_ITEM_3: string = 'NavDestination_item_3';
public static readonly NavDestinationData: NavDestinationItem[] = [
{
id: Constants.NAV_DESTINATION_ITEM_0, detail: $r('app.string.nav_destination_item0')
},
{
id: Constants.NAV_DESTINATION_ITEM_1, detail: $r('app.string.nav_destination_item1')
},
{
id: Constants.NAV_DESTINATION_ITEM_2, detail: $r('app.string.nav_destination_item2')
},
{
id: Constants.NAV_DESTINATION_ITEM_3, detail: $r('app.string.nav_destination_item3')
},
];
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/common/Constants.ets#L21-L75
|
49578d7456b0d7b105c3cb56c3caa20a1a509206
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/auth/src/main/ets/view/LoginPage.ets
|
arkts
|
构建登录页面
@returns {void} 无返回值
|
build(): void {
AppNavDestination({
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") }
}) {
this.LoginContent();
}
}
|
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left pageBackgroundColor : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_white" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left titleOptions : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_white" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LoginContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build(): void {
AppNavDestination({
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") }
}) {
this.LoginContent();
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/LoginPage.ets#L36-L44
|
a9c6cd323e1b3a8d6eab4b59ce1aa4b38eab8a36
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/WindowManagement/WindowManage/WindowComponent/index.ets
|
arkts
|
WindowComponent
|
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { WindowComponent } from './src/main/ets/components/MainPage/MainPage'
|
AST#export_declaration#Left export { WindowComponent } from './src/main/ets/components/MainPage/MainPage' AST#export_declaration#Right
|
export { WindowComponent } from './src/main/ets/components/MainPage/MainPage'
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/WindowManagement/WindowManage/WindowComponent/index.ets#L16-L16
|
0f57d2748ee22b322bdb79e9c442375fcfdec769
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/Message.ets
|
arkts
|
消息体
|
export interface Message {
id: string;
//发送者
sender: string;
//头像
avatar: string;
//消息类型
type: number;
//消息内容
content: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Message 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 sender : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //头像 AST#type_member#Left avatar : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //消息类型 AST#type_member#Left type : 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 content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface Message {
id: string;
sender: string;
avatar: string;
type: number;
content: string;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/Message.ets#L19-L29
|
e7dd11579204b032ffb3fb7b869241494cc3a164
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
WaterFlowSample/entry/src/main/ets/pages/DataLoadMorePage.ets
|
arkts
|
[EndExclude quick_start]
|
build() {
Column({ space: 0 }) {
Refresh({ refreshing: $$this.isRefreshing, builder: this.headerRefresh() }) {
WaterFlow({ scroller: this.scroller, sections: this.sections }) {
// [StartExclude quick_start]
LazyForEach(this.dataSource, (item: number) => {
FlowItem() {
Stack() {
Row() {
Button('Delete')
.fontColor(Color.Red)
.backgroundColor(Color.White)
.onClick(() => {
try {
this.getUIContext().animateTo({ duration: 300 }, () => {
this.removeItem(item);
});
} catch (err) {
hilog.error(0x0000, TAG, `animateTo get exception, error:${JSON.stringify(err)}.`);
}
})
}
.width('100%')
.height('100%')
.borderRadius(8)
.justifyContent(FlexAlign.Center)
.zIndex(1)
.visibility(this.currentItem === item ? Visibility.Visible : Visibility.Hidden)
.backgroundColor('#33000000')
ReusableFlowItem({ item: item })
}
}
.transition({ type: TransitionType.Delete, opacity: 0 })
.priorityGesture(LongPressGesture()
.onAction(() => {
this.currentItem = item;
}))
.width('100%')
.borderRadius(8)
.backgroundColor(Color.Gray)
}, (item: string) => item)
// [EndExclude quick_start]
}
.cachedCount(12)
.columnsGap(8)
.rowsGap(8)
.width('100%')
.height('100%')
.layoutWeight(1)
// For better experience, pre load data.
.onScrollIndex((first: number, last: number) => {
// 1、Obtain the total amount of data in the waterfall flow.
let totalCount: number = this.dataSource.totalCount();
// 2、If the index of the last visible area is greater than the total amount of data, it triggers loading more.
if (last + 20 >= totalCount) {
// 3、Re-add 20 data entries to the waterfall.
for (let i: number = 0; i < 20; i++) {
this.dataSource.addLastItem();
}
// 4、Update the itemsCount in the group and refresh the group information.
this.dataSection.itemsCount += 20;
this.sections.update(2, this.dataSection);
}
})
}
// [StartExclude quick_start]
.refreshOffset(56)
.onRefreshing(() => {
this.refresh();
})
// [EndExclude quick_start]
}
.padding({
top: this.statusBarHeight
})
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Refresh ( AST#component_parameters#Left { AST#component_parameter#Left refreshing : AST#expression#Left AST#member_expression#Left AST#expression#Left $$this AST#expression#Right . isRefreshing AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left builder : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . headerRefresh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left WaterFlow ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sections : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sections AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // [StartExclude quick_start] AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left FlowItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'Delete' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . animateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . removeItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` animateTo get exception, error: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right . ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentItem AST#member_expression#Right AST#expression#Right === AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#33000000' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ReusableFlowItem ( AST#component_parameters#Left { AST#component_parameter#Left item : AST#expression#Left item AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . transition ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionType AST#expression#Right . Delete AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left opacity AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . priorityGesture ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left LongPressGesture AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentItem AST#member_expression#Right = AST#expression#Left item AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left item AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right // [EndExclude quick_start] } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . cachedCount ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) // For better experience, pre load data. AST#modifier_chain_expression#Left . onScrollIndex ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left first : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left last : 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 { // 1、Obtain the total amount of data in the waterfall flow. AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left totalCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . totalCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 2、If the index of the last visible area is greater than the total amount of data, it triggers loading more. AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left last AST#expression#Right + AST#expression#Left 20 AST#expression#Right AST#binary_expression#Right AST#expression#Right >= AST#expression#Left totalCount AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 3、Re-add 20 data entries to the waterfall. AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 20 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . addLastItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // 4、Update the itemsCount in the group and refresh the group information. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSection AST#member_expression#Right AST#expression#Right . itemsCount AST#member_expression#Right += AST#expression#Left 20 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sections AST#member_expression#Right AST#expression#Right . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSection AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right // [StartExclude quick_start] AST#modifier_chain_expression#Left . refreshOffset ( AST#expression#Left 56 AST#expression#Right ) AST#modifier_chain_expression#Left . onRefreshing ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refresh AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [EndExclude quick_start] } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusBarHeight AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column({ space: 0 }) {
Refresh({ refreshing: $$this.isRefreshing, builder: this.headerRefresh() }) {
WaterFlow({ scroller: this.scroller, sections: this.sections }) {
LazyForEach(this.dataSource, (item: number) => {
FlowItem() {
Stack() {
Row() {
Button('Delete')
.fontColor(Color.Red)
.backgroundColor(Color.White)
.onClick(() => {
try {
this.getUIContext().animateTo({ duration: 300 }, () => {
this.removeItem(item);
});
} catch (err) {
hilog.error(0x0000, TAG, `animateTo get exception, error:${JSON.stringify(err)}.`);
}
})
}
.width('100%')
.height('100%')
.borderRadius(8)
.justifyContent(FlexAlign.Center)
.zIndex(1)
.visibility(this.currentItem === item ? Visibility.Visible : Visibility.Hidden)
.backgroundColor('#33000000')
ReusableFlowItem({ item: item })
}
}
.transition({ type: TransitionType.Delete, opacity: 0 })
.priorityGesture(LongPressGesture()
.onAction(() => {
this.currentItem = item;
}))
.width('100%')
.borderRadius(8)
.backgroundColor(Color.Gray)
}, (item: string) => item)
}
.cachedCount(12)
.columnsGap(8)
.rowsGap(8)
.width('100%')
.height('100%')
.layoutWeight(1)
.onScrollIndex((first: number, last: number) => {
let totalCount: number = this.dataSource.totalCount();
if (last + 20 >= totalCount) {
for (let i: number = 0; i < 20; i++) {
this.dataSource.addLastItem();
}
this.dataSection.itemsCount += 20;
this.sections.update(2, this.dataSection);
}
})
}
.refreshOffset(56)
.onRefreshing(() => {
this.refresh();
})
}
.padding({
top: this.statusBarHeight
})
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/DataLoadMorePage.ets#L228-L305
|
6ec42a7647a8abb348857c74b2759ea3490e8b48
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets
|
arkts
|
this
|
禁用x和y轴方向同时缩放,但是可以单独x轴方向或者y轴方向缩放
|
this.model.setPinchZoom(false);
|
AST#method_declaration#Left this AST#ERROR#Left . model . setP in chZoom AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left false AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
|
this.model.setPinchZoom(false);
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets#L125-L125
|
6637aa7b545faf4ee2bca20779d271720d0dcb36
|
gitee
|
weiwei0928/Eyepetizer-harmony.git
|
fd5947c6f616c22d42256f36ba752093b782a910
|
entry/src/main/ets/common/utils/SPUtil.ets
|
arkts
|
delete
|
删除值
@param key
@param preferenceName
@returns
|
static async delete(key: string, preferenceName: string = defaultPreferenceName) {
let preferences = await SPUtil.getPreferences(preferenceName)
return await preferences.delete(key)
}
|
AST#method_declaration#Left static async delete 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 preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left defaultPreferenceName AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left preferences = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left SPUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left preferenceName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left preferences AST#expression#Right AST#await_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async delete(key: string, preferenceName: string = defaultPreferenceName) {
let preferences = await SPUtil.getPreferences(preferenceName)
return await preferences.delete(key)
}
|
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/utils/SPUtil.ets#L51-L54
|
ad35168e431d681d6f475edd96b5d664b032390b
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/DateUtil.ets
|
arkts
|
getFormatDate
|
获取格式化日期,将传入的日期格式化为Date
@param date number类型的时间戳10-13位数据
@returns
|
static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) { //无参数
date = new Date();
} else if (typeof date == "string") { //字符串日期
if (date.length == 0) {
date = new Date();
} else if (RegexUtil.isDigits(date)) { //字符串类型的时间戳(10-13位)
date = new Date(DateUtil.padTimestamp(date));
} else {
const dateStr = DateUtil.formatDateStr(date);
date = new Date(dateStr);
}
} else if (typeof date == "number") { //时间戳(10-13位)
date = new Date(DateUtil.padTimestamp(date));
}
return date;
}
|
AST#method_declaration#Left static getFormatDate AST#parameter_list#Left ( AST#parameter#Left date ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left date AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left date AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { //无参数 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left date AST#expression#Right AST#unary_expression#Right AST#expression#Right == AST#expression#Left "string" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { //字符串日期 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . length AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RegexUtil AST#expression#Right . isDigits AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { //字符串类型的时间戳(10-13位) AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . padTimestamp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left dateStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . formatDateStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dateStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left date AST#expression#Right AST#unary_expression#Right AST#expression#Right == AST#expression#Left "number" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { //时间戳(10-13位) AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . padTimestamp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left date AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) {
date = new Date();
} else if (typeof date == "string") {
if (date.length == 0) {
date = new Date();
} else if (RegexUtil.isDigits(date)) {
date = new Date(DateUtil.padTimestamp(date));
} else {
const dateStr = DateUtil.formatDateStr(date);
date = new Date(dateStr);
}
} else if (typeof date == "number") {
date = new Date(DateUtil.padTimestamp(date));
}
return date;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L32-L48
|
670ebb068421d6d073ca606e1adf8266de622399
|
gitee
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Select/entry/src/main/ets/pages/components/toggle/toggleEnable.ets
|
arkts
|
ToggleEnableBuilder
|
Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Builder
export function ToggleEnableBuilder(name: string, param: Object) {
ToggleEnableExample()
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToggleEnableBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ToggleEnableExample ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
|
@Builder
export function ToggleEnableBuilder(name: string, param: Object) {
ToggleEnableExample()
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/toggle/toggleEnable.ets#L16-L19
|
ac01d08263a3d1a46d1173a8e9b1dff25a3404bf
|
gitee
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/core/eventbus/EventBus.ets
|
arkts
|
off
|
取消订阅
|
off(event: string, callback?: EventCallback): void {
if (!this.events.has(event)) {
return;
}
if (callback) {
const callbacks = this.events.get(event);
if (callbacks) {
const index = callbacks.indexOf(callback);
if (index > -1) {
callbacks.splice(index, 1);
}
}
} else {
this.events.delete(event);
}
Logger.debug('EventBus', `Unsubscribed from event: ${event}`);
}
|
AST#method_declaration#Left off AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left EventCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . events AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left callback AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left callbacks = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . events AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left callbacks AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left callbacks AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right > AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left callbacks AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . events AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'EventBus' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Unsubscribed from event: AST#template_substitution#Left $ { AST#expression#Left event AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
off(event: string, callback?: EventCallback): void {
if (!this.events.has(event)) {
return;
}
if (callback) {
const callbacks = this.events.get(event);
if (callbacks) {
const index = callbacks.indexOf(callback);
if (index > -1) {
callbacks.splice(index, 1);
}
}
} else {
this.events.delete(event);
}
Logger.debug('EventBus', `Unsubscribed from event: ${event}`);
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/eventbus/EventBus.ets#L48-L65
|
8a1810c60ee14ce2cc5d904afd20f372a97b6b56
|
github
|
euler1129/Cloud-flash-payment.git
|
dfb70c1c67b3b69447f4384661e16b60f40495de
|
entry/src/main/ets/pages/registerPage/register.ets
|
arkts
|
叉号,显隐标识
|
build(){
Column(){
//返回箭头
Row(){
Image($r('app.media.ic_back'))
.width(30)
.height(30)
.margin({top:15})
.onClick(()=>{
AlertDialog.show({
message:"输入手机号即可轻松完成注册,\n您确定要返回吗?"
,primaryButton:{
value:"返回"
,fontColor:Color.Red
,backgroundColor:Color.White
,action: () => {
router.back();
}
}
,secondaryButton:{
value:"继续注册"
,fontColor:Color.White
,backgroundColor:Color.Red
,action:()=>{
}
}
})
})
}.width('94%')
.justifyContent(FlexAlign.Start)
//文字,手机号注册
Row(){
Text("手机号注册")
.fontWeight(FontWeight.Bold)
.fontColor("#000")
.fontSize(30)
.width('100%')
.textAlign(TextAlign.Start)
}.width('94%')
.margin({top:40})
.justifyContent(FlexAlign.Start)
//国家/地区选择
Row(){
Text("国家/地区").width('30%')
.fontSize(18)
.fontColor(Color.Gray)
Row(){
Text(`${this.country}`)
.fontSize(18)
.fontColor(Color.Black)
Image($r('app.media.right_grey'))
.width('30%')
.height('30%')
}.width('70%')
.justifyContent(FlexAlign.SpaceAround)
.onClick(()=>{
router.pushUrl({
url:'pages/registerPage/countrySelection'
}
,router.RouterMode.Single
)
})
.justifyContent(FlexAlign.SpaceBetween)
}.border({width:{bottom:"2px"},color:{bottom:Color.Grey} })
.padding({bottom:"2"})
.margin({top:80,left:10,right:20})
.width('95%')
.height('50')
//手机区号,手机号输入
Row(){
Row(){
Text(`${this.tel}`)
.fontSize(18)
.fontColor(Color.Gray)
} .width('25%')
.onClick(()=>{
router.pushUrl({
url:'pages/registerPage/countrySelection'
})
})
Row(){
TextInput({ placeholder:"请输入手机号"
,text:(this.phone.length<8?
this.phone.replace(/\D+/g, '').replace(/^(\d{3})/g, "$1 ").replace(/\s$/, '')
:this.phone.replace(/\D+/g, '').replace(/^(\d{3})(\d{4})/g, "$1 $2 ").replace(/\s$/, '')
)})
.placeholderColor('#BAC2C3')
.placeholderFont({ size:20,weight:FontWeight.Bold })
.fontSize(20)
.fontWeight(FontWeight.Bold)
.type(InputType.PhoneNumber)//电话号码输入模式。支持输入数字、+ 、-、*、#,长度不限。
.width('85%')
.maxLength(13)
.onChange((value:string)=>{
if(value.replace(' ','')!=''){
this.isEnabled=true;
this.isVisibility=true;
if(value.length<8)
{
this.phone=value.replace(/\D+/g, '').replace(/^(\d{3})/g, "$1 ").replace(/\s$/, '')
}else{
this.phone=value.replace(/\D+/g, '').replace(/^(\d{3})(\d{4})/g, "$1 $2 ").replace(/\s$/, '')
}
}else{
this.isEnabled=false;
this.isVisibility=false;
}
})
Image($r("app.media.cancel"))
.visibility(this.isVisibility?Visibility.Visible:Visibility.Hidden)
.onClick(()=>{
this.phone='';
})
.width('10%')
.height('30%')
} .width('75%')
}.border({width:{bottom:"2px"},color:{bottom:Color.Grey} })
.padding({bottom:"2"})
.margin({top:20,left:10,bottom:20,right:20})
.width('95%')
.height('60')
//用户协议
Column(){
Row(){
Checkbox()
.selectedColor(Color.Red)
.onChange((value:boolean)=>{
this.isChecked=value;
})
Text(' 我已阅读并同意').fontSize(16).fontColor(0x737373);
Text('《隐私保护协议》').fontSize(16).fontSize(16).fontColor(this.isChecked?Color.Red:0x10396F).fontWeight(500);
Text('及').fontSize(16).fontColor(0x737373).padding({ left: 20 });
}
Row(){
Text('《联通统一认证服务条款》').fontSize(16).fontSize(16).fontColor(this.isChecked?Color.Red:0x10396F).padding({ left: 20 })
}
}.width('95%')
.height('60')
.alignItems(HorizontalAlign.Start)
//注册按钮
Row(){
Button("注册")
.type(ButtonType.Normal)
.backgroundColor(Color.Red)
.fontColor(Color.White)
.fontSize(25)
.stateEffect(false)
.opacity(this.isEnabled&&this.isChecked?1:0.6)
.enabled(this.isEnabled&&this.isChecked?true:false)
.width('100%')
.height('100%')
.onClick(()=>{
//console.log("phone="+this.phone);
if(/^1[3456789]\d{9}$/.test(this.phone.replace(/(\D{1})/g, ''))){
this.phone=this.phone.replace(/\s/g, '');
globalThis.globalPhone=this.phone;
router.pushUrl({
url:'pages/registerPage/verification',
params:{
phone1:this.phone
}
}
,router.RouterMode.Single
)
setTimeout(()=>{myNotification();},2000);
}else {
AlertDialog.show(
{
message: "手机号格式不正确,请重新输入。",
confirm:{
value: "确定",
fontColor:"#FFF",
backgroundColor:"red",
action: () => {
this.phone=this.phone.replace(/^(\d{3})(\d{4})/g, "$1 $2 ").replace(/\s$/, '');
}
}
}
)
}
})
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { //返回箭头 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_back' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AlertDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left "输入手机号即可轻松完成注册,\n您确定要返回吗?" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left primaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left "返回" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left "继续注册" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '94%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //文字,手机号注册 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "手机号注册" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left "#000" AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '94%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 40 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //国家/地区选择 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "国家/地区" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . country AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.right_grey' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '70%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left 'pages/registerPage/countrySelection' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . RouterMode AST#member_expression#Right AST#expression#Right . Single AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left "2px" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left "2" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 80 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '95%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '50' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //手机区号,手机号输入 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tel AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '25%' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left 'pages/registerPage/countrySelection' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left "请输入手机号" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \D AST#ERROR#Right AST#expression#Left AST#unary_expression#Left + AST#expression#Left AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#ERROR#Left g , AST#ERROR#Right AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / ^ AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \d AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 3 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left "$1 " AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / AST#ERROR#Left \s AST#ERROR#Right $ AST#ERROR#Left / , AST#ERROR#Right AST#expression#Left '' AST#expression#Right ) AST#ERROR#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \D AST#ERROR#Right AST#expression#Left AST#unary_expression#Left + AST#expression#Left AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#ERROR#Left g , AST#ERROR#Right AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / ^ AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \d AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 3 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left \d { AST#property_name#Left 4 AST#property_name#Right } AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left "$1 $2 " AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \s AST#ERROR#Right AST#expression#Left AST#state_binding_expression#Left $ AST#ERROR#Left / , AST#ERROR#Right AST#member_expression#Left AST#expression#Left '' AST#expression#Right AST#ERROR#Left ) ) } ) AST#ERROR#Right . placeholderColor AST#member_expression#Right AST#state_binding_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#BAC2C3' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . placeholderFont AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 20 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontWeight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . PhoneNumber AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right //电话号码输入模式。支持输入数字、+ 、-、*、#,长度不限。 . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '85%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . maxLength AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 13 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ' ' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right != AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isVisibility AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \D AST#ERROR#Right AST#expression#Left AST#unary_expression#Left + AST#expression#Left AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left '' AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . replace AST#member_expression#Right AST#expression#Right AST#ERROR#Left ( / AST#ERROR#Right ^ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \d AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 3 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left "$1 " AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \s AST#ERROR#Right AST#expression#Left AST#state_binding_expression#Left $ AST#ERROR#Left / , AST#expression#Left '' AST#expression#Right ) } else AST#ERROR#Right AST#member_expression#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . phone AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \D AST#ERROR#Right AST#expression#Left AST#unary_expression#Left + AST#expression#Left AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#ERROR#Left g , AST#ERROR#Right AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . replace AST#member_expression#Right AST#state_binding_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ( / AST#ERROR#Right ^ AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \d AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 3 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left \d { AST#property_name#Left 4 AST#property_name#Right } AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left "$1 $2 " AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left / AST#ERROR#Left \s AST#ERROR#Right $ AST#ERROR#Left / , AST#ERROR#Right AST#expression#Left '' AST#expression#Right ) AST#ERROR#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isVisibility AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left Image AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.cancel" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . visibility AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isVisibility AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '10%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '30%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '75%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left "2px" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left "2" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '95%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '60' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //用户协议 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Checkbox ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isChecked AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left ' 我已阅读并同意' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 0x737373 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '《隐私保护协议》' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isChecked AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right : AST#expression#Left 0x10396F AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 500 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '及' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 0x737373 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '《联通统一认证服务条款》' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isChecked AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right : AST#expression#Left 0x10396F AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '95%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '60' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //注册按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left "注册" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 25 AST#expression#Right ) AST#modifier_chain_expression#Left . stateEffect ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . isChecked AST#member_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0.6 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . isChecked AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick AST#ERROR#Left ( AST#parameter_list#Left ( ) AST#parameter_list#Right => { //console.log("phone="+this.phone); if ( AST#ERROR#Left / ^ AST#expression#Left AST#subscript_expression#Left AST#expression#Left 1 AST#expression#Right [ AST#expression#Left 3456789 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right \d { AST#property_name#Left 9 AST#property_name#Right } AST#ERROR#Right $ / AST#ERROR#Right AST#modifier_chain_expression#Left . test ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \D AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 1 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ) AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . phone AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / \s AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left , AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '' AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left globalThis AST#expression#Right . globalPhone AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left 'pages/registerPage/verification' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left phone1 AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . RouterMode AST#member_expression#Right AST#expression#Right . Single AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#ui_custom_component_statement#Left setTimeout ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left myNotification AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 2000 AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left else AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AlertDialog AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left "手机号格式不正确,请重新输入。" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left confirm AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left "确定" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left "#FFF" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left "red" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phone AST#member_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#ERROR#Left ( / AST#ERROR#Right ^ AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \d AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 3 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left \d { AST#property_name#Left 4 AST#property_name#Right } AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left "$1 $2 " AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / AST#ERROR#Left \s AST#ERROR#Right $ AST#ERROR#Left / , AST#ERROR#Right AST#expression#Left '' AST#expression#Right ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ) AST#ERROR#Right } AST#build_body#Right AST#build_method#Right
|
build(){
Column(){
Row(){
Image($r('app.media.ic_back'))
.width(30)
.height(30)
.margin({top:15})
.onClick(()=>{
AlertDialog.show({
message:"输入手机号即可轻松完成注册,\n您确定要返回吗?"
,primaryButton:{
value:"返回"
,fontColor:Color.Red
,backgroundColor:Color.White
,action: () => {
router.back();
}
}
,secondaryButton:{
value:"继续注册"
,fontColor:Color.White
,backgroundColor:Color.Red
,action:()=>{
}
}
})
})
}.width('94%')
.justifyContent(FlexAlign.Start)
Row(){
Text("手机号注册")
.fontWeight(FontWeight.Bold)
.fontColor("#000")
.fontSize(30)
.width('100%')
.textAlign(TextAlign.Start)
}.width('94%')
.margin({top:40})
.justifyContent(FlexAlign.Start)
Row(){
Text("国家/地区").width('30%')
.fontSize(18)
.fontColor(Color.Gray)
Row(){
Text(`${this.country}`)
.fontSize(18)
.fontColor(Color.Black)
Image($r('app.media.right_grey'))
.width('30%')
.height('30%')
}.width('70%')
.justifyContent(FlexAlign.SpaceAround)
.onClick(()=>{
router.pushUrl({
url:'pages/registerPage/countrySelection'
}
,router.RouterMode.Single
)
})
.justifyContent(FlexAlign.SpaceBetween)
}.border({width:{bottom:"2px"},color:{bottom:Color.Grey} })
.padding({bottom:"2"})
.margin({top:80,left:10,right:20})
.width('95%')
.height('50')
Row(){
Row(){
Text(`${this.tel}`)
.fontSize(18)
.fontColor(Color.Gray)
} .width('25%')
.onClick(()=>{
router.pushUrl({
url:'pages/registerPage/countrySelection'
})
})
Row(){
TextInput({ placeholder:"请输入手机号"
,text:(this.phone.length<8?
this.phone.replace(/\D+/g, '').replace(/^(\d{3})/g, "$1 ").replace(/\s$/, '')
:this.phone.replace(/\D+/g, '').replace(/^(\d{3})(\d{4})/g, "$1 $2 ").replace(/\s$/, '')
)})
.placeholderColor('#BAC2C3')
.placeholderFont({ size:20,weight:FontWeight.Bold })
.fontSize(20)
.fontWeight(FontWeight.Bold)
.type(InputType.PhoneNumber)
.width('85%')
.maxLength(13)
.onChange((value:string)=>{
if(value.replace(' ','')!=''){
this.isEnabled=true;
this.isVisibility=true;
if(value.length<8)
{
this.phone=value.replace(/\D+/g, '').replace(/^(\d{3})/g, "$1 ").replace(/\s$/, '')
}else{
this.phone=value.replace(/\D+/g, '').replace(/^(\d{3})(\d{4})/g, "$1 $2 ").replace(/\s$/, '')
}
}else{
this.isEnabled=false;
this.isVisibility=false;
}
})
Image($r("app.media.cancel"))
.visibility(this.isVisibility?Visibility.Visible:Visibility.Hidden)
.onClick(()=>{
this.phone='';
})
.width('10%')
.height('30%')
} .width('75%')
}.border({width:{bottom:"2px"},color:{bottom:Color.Grey} })
.padding({bottom:"2"})
.margin({top:20,left:10,bottom:20,right:20})
.width('95%')
.height('60')
Column(){
Row(){
Checkbox()
.selectedColor(Color.Red)
.onChange((value:boolean)=>{
this.isChecked=value;
})
Text(' 我已阅读并同意').fontSize(16).fontColor(0x737373);
Text('《隐私保护协议》').fontSize(16).fontSize(16).fontColor(this.isChecked?Color.Red:0x10396F).fontWeight(500);
Text('及').fontSize(16).fontColor(0x737373).padding({ left: 20 });
}
Row(){
Text('《联通统一认证服务条款》').fontSize(16).fontSize(16).fontColor(this.isChecked?Color.Red:0x10396F).padding({ left: 20 })
}
}.width('95%')
.height('60')
.alignItems(HorizontalAlign.Start)
Row(){
Button("注册")
.type(ButtonType.Normal)
.backgroundColor(Color.Red)
.fontColor(Color.White)
.fontSize(25)
.stateEffect(false)
.opacity(this.isEnabled&&this.isChecked?1:0.6)
.enabled(this.isEnabled&&this.isChecked?true:false)
.width('100%')
.height('100%')
.onClick(()=>{
if(/^1[3456789]\d{9}$/.test(this.phone.replace(/(\D{1})/g, ''))){
this.phone=this.phone.replace(/\s/g, '');
globalThis.globalPhone=this.phone;
router.pushUrl({
url:'pages/registerPage/verification',
params:{
phone1:this.phone
}
}
,router.RouterMode.Single
)
setTimeout(()=>{myNotification();},2000);
}else {
AlertDialog.show(
{
message: "手机号格式不正确,请重新输入。",
confirm:{
value: "确定",
fontColor:"#FFF",
backgroundColor:"red",
action: () => {
this.phone=this.phone.replace(/^(\d{3})(\d{4})/g, "$1 $2 ").replace(/\s$/, '');
}
}
}
)
}
})
}
|
https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/registerPage/register.ets#L23-L219
|
188a9ca076afcbf3dfc22f02046481a45184cb09
|
github
|
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_axios/src/main/ets/axios/EfClientApi.ets
|
arkts
|
appendHeader
|
拼接header
@param headers 传入的header
@returns 拼接结果
|
private static appendHeader(headers?: Record<string, Object>): AxiosHeaders {
let addHead: AxiosHeaders = new AxiosHeaders();
//是否有传入header
if (headers) {
Object.entries(headers).forEach((row) => {
addHead.set(row[0], row[1] as string, true);
});
}
//是否有公共header
if (efAxiosParams.headers) {
Object.entries(efAxiosParams.headers).forEach((row) => {
addHead.set(row[0], row[1] as string, true);
});
}
return addHead;
}
|
AST#method_declaration#Left private static appendHeader AST#parameter_list#Left ( AST#parameter#Left headers ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AxiosHeaders AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left addHead : AST#type_annotation#Left AST#primary_type#Left AxiosHeaders AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AxiosHeaders AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //是否有传入header AST#statement#Left AST#if_statement#Left if ( AST#expression#Left headers AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left headers AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left row AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left addHead AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //是否有公共header AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left efAxiosParams AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left efAxiosParams AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left row AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left addHead AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left addHead AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static appendHeader(headers?: Record<string, Object>): AxiosHeaders {
let addHead: AxiosHeaders = new AxiosHeaders();
if (headers) {
Object.entries(headers).forEach((row) => {
addHead.set(row[0], row[1] as string, true);
});
}
if (efAxiosParams.headers) {
Object.entries(efAxiosParams.headers).forEach((row) => {
addHead.set(row[0], row[1] as string, true);
});
}
return addHead;
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L40-L56
|
6be78acff247068657e3e5d040830ab9f1f51f50
|
gitee
|
openharmony/update_update_app
|
0157b7917e2f48e914b5585991e8b2f4bc25108a
|
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
|
arkts
|
getCurrentVersionDescription
|
获取当前版本升级日志
@return 当前版本描述文件
|
async getCurrentVersionDescription(): Promise<UpgradeData<Array<update.ComponentDescription>>> {
return this.updateManager.getCurrentVersionDescription(update.DescriptionFormat.STANDARD,
DeviceUtils.getSystemLanguage());
}
|
AST#method_declaration#Left async getCurrentVersionDescription AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left UpgradeData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left update . ComponentDescription AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateManager AST#member_expression#Right AST#expression#Right . getCurrentVersionDescription AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left update AST#expression#Right . DescriptionFormat AST#member_expression#Right AST#expression#Right . STANDARD AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceUtils AST#expression#Right . getSystemLanguage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getCurrentVersionDescription(): Promise<UpgradeData<Array<update.ComponentDescription>>> {
return this.updateManager.getCurrentVersionDescription(update.DescriptionFormat.STANDARD,
DeviceUtils.getSystemLanguage());
}
|
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L121-L124
|
20af3a83464a0a5b32f064b87dc38f8aa148aa97
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
|
arkts
|
ArkWeb工具类
|
export class ArkWebHelper {
private static context: common.UIAbilityContext; //common.UIAbilityContext,上下文
static debug: boolean = false; //是否是debug模式
static tag: string = 'ArkWeb'; //日志Tag
static level: hilog.LogLevel = hilog.LogLevel.INFO //日志Level
/**
* 初始化
* @param context UIAbilityContext
* @param debug 是否是debug模式
* @param tag 日志Tag
* @param level 日志Level
*/
static initialize(context: common.UIAbilityContext, debug: boolean = false, tag: string = 'ArkWeb',
level: hilog.LogLevel = hilog.LogLevel.INFO) {
ArkWebHelper.context = context;
ArkWebHelper.debug = debug;
ArkWebHelper.tag = tag;
ArkWebHelper.level = level;
webview.WebviewController.initializeWebEngine();
webview.WebviewController.setWebDebuggingAccess(debug);
DownloadUtils.onAbilityLifecycle(ArkWebHelper.context);
}
/**
* 获取上下文,common.UIAbilityContext
* @returns
*/
static getContext(): common.UIAbilityContext {
if (!ArkWebHelper.context) {
ArkWebHelper.context = getContext() as common.UIAbilityContext; //兜底
Tools.logError("请在UIAbility的onCreate方法中调用ArkWebHelper的init方法初始化!");
}
return ArkWebHelper.context;
}
/**
* 预连接url,在加载url之前调用此API。
* @param url 预连接的url。
* @param preconnectable 是否进行预连接。如果preconnectable为true,则对url进行dns解析,socket建链预连接;如果preconnectable为false,则不做任何预连接操作。
* @param numSockets 要预连接的socket数。socket数目连接需要大于0,最多允许6个连接。
*/
static prepareForPageLoad(url: string | string[], preconnectable: boolean = true, numSockets: number = 2) {
if (Array.isArray(url)) {
url.forEach((item) => webview.WebviewController.prepareForPageLoad(item, preconnectable, numSockets))
} else {
webview.WebviewController.prepareForPageLoad(url, preconnectable, numSockets);
}
}
/**
* 异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScript需要在loadUrl完成后,比如onPageEnd中调用。
* @param webController
* @param script JavaScript脚本
* @returns
*/
static async runJavaScript(webController: webview.WebviewController, script: string): Promise<string> {
return webController.runJavaScript(script);
}
/**
* 异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScriptExt需要在loadUrl完成后,比如onPageEnd中调用。
* @param webController
* @param script JavaScript脚本。
* @returns
*/
static async runJavaScriptExt(webController: webview.WebviewController, script: string | ArrayBuffer): Promise<webview.JsMessageExt> {
return webController.runJavaScriptExt(script);
}
/**
* 异步执行JavaScript方法
* @param webController
* @param funName 方法名
* @param param 方法参数
* @returns
*/
static async runJavaScriptFun(webController: webview.WebviewController, funName: string, param?: string): Promise<string> {
if (param) {
return ArkWebHelper.runJavaScript(webController, `${funName}('${param}')`);
} else {
return ArkWebHelper.runJavaScript(webController, `${funName}()`);
}
}
/**
* 以Promise方式异步获取指定url对应cookie的值。
* @param url 要获取的cookie所属的url,建议使用完整的url。
* @returns
*/
static async fetchCookie(url: string): Promise<string> {
return await webview.WebCookieManager.fetchCookie(url);
}
/**
* 获取指定url对应cookie的值。
* @param url 要获取的cookie所属的url,建议使用完整的url。
* @param incognito true表示获取隐私模式下webview的内存cookies,false表示正常非隐私模式下的cookies。
* @returns
*/
static fetchCookieSync(url: string, incognito?: boolean): string {
return webview.WebCookieManager.fetchCookieSync(url, incognito);
}
/**
* 以异步Promise方式为指定url设置单个cookie的值。
* @param url 要设置的cookie所属的url,建议使用完整的url。
* @param value 要设置的cookie的值。
*/
static async configCookie(url: string, value: string): Promise<void> {
return await webview.WebCookieManager.configCookie(url, value);
}
/**
* 为指定url设置单个cookie的值。
* @param url 要设置的cookie所属的url,建议使用完整的url。
* @param value 要设置的cookie的值。
* @param incognito true表示设置隐私模式下对应url的cookies,false表示设置正常非隐私模式下对应url的cookies。
*/
static configCookieSync(url: string, value: string, incognito?: boolean) {
webview.WebCookieManager.configCookieSync(url, value, incognito);
}
/**
* 将当前存在内存中的cookie以Promise方法异步保存到磁盘中。
* @returns
*/
static async saveCookieAsync(): Promise<void> {
return await webview.WebCookieManager.saveCookieAsync();
}
/**
* 设置WebCookieManager实例是否拥有发送和接收cookie的权限。
* @param accept 设置是否拥有发送和接收cookie的权限,默认为true。
*/
static putAcceptCookieEnabled(accept: boolean): void {
webview.WebCookieManager.putAcceptCookieEnabled(accept);
}
/**
* 获取WebCookieManager实例是否拥有发送和接收cookie的权限。
* @returns
*/
static isCookieAllowed(): boolean {
return webview.WebCookieManager.isCookieAllowed();
}
/**
* 设置WebCookieManager实例是否拥有发送和接收第三方cookie的权限。
* @param accept 设置是否拥有发送和接收第三方cookie的权限,默认为false。
*/
static putAcceptThirdPartyCookieEnabled(accept: boolean): void {
webview.WebCookieManager.putAcceptThirdPartyCookieEnabled(accept);
}
/**
* 获取WebCookieManager实例是否拥有发送和接收第三方cookie的权限。
* @returns
*/
static isThirdPartyCookieAllowed(): boolean {
return webview.WebCookieManager.isThirdPartyCookieAllowed();
}
/**
* 获取是否存在cookie。
* @param incognito true表示隐私模式下查询是否存在cookies,false表示正常非隐私模式下查询是否存在cookies。
* @returns
*/
static existCookie(incognito?: boolean): boolean {
return webview.WebCookieManager.existCookie(incognito);
}
/**
* 异步promise方式清除所有cookie。
* @returns
*/
static async clearAllCookies(): Promise<void> {
return await webview.WebCookieManager.clearAllCookies();
}
/**
* 清除所有cookie。
* @param incognito true表示清除隐私模式下webview的所有内存cookies,false表示清除正常非隐私模式下的持久化cookies。
*/
static clearAllCookiesSync(incognito?: boolean): void {
webview.WebCookieManager.clearAllCookiesSync(incognito);
}
/**
* 异步promise方式清除所有会话cookie。
* @returns
*/
static async clearSessionCookie(): Promise<void> {
return await webview.WebCookieManager.clearSessionCookie();
}
/**
* 清除所有会话cookie。
*/
static clearSessionCookieSync(): void {
webview.WebCookieManager.clearSessionCookieSync();
}
/**
* 以Promise方式异步获取当前使用Web SQL数据库的所有源的信息。
* @returns
*/
static async getOrigins(): Promise<Array<webview.WebStorageOrigin>> {
return await webview.WebStorage.getOrigins();
}
/**
* 以Promise方式异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。
* @param origin 指定源的字符串索引
* @returns
*/
static async getOriginQuota(origin: string): Promise<number> {
return await webview.WebStorage.getOriginQuota(origin);
}
/**
* 以Promise方式异步获取指定源的Web SQL数据库的存储量,存储量以字节为单位。
* @param origin 指定源的字符串索引
* @returns
*/
static async getOriginUsage(origin: string): Promise<number> {
return await webview.WebStorage.getOriginUsage(origin);
}
/**
* 清除指定源所使用的存储。
* @param origin 指定源的字符串索引,来自于getOrigins。
*/
static deleteOrigin(origin: string): void {
webview.WebStorage.deleteOrigin(origin);
}
/**
* 清除Web SQL数据库当前使用的所有存储。
* @param incognito 清除Web SQL数据库当前使用的所有存储。
*/
static deleteAllData(incognito?: boolean): void {
webview.WebStorage.deleteAllData(incognito);
}
/**
* 检索给定主机和域的HTTP身份验证凭据,该方法为同步方法。
* @param host HTTP身份验证凭据应用的主机。
* @param realm HTTP身份验证凭据应用的域。
* @returns
*/
static getHttpAuthCredentials(host: string, realm: string): Array<string> {
return webview.WebDataBase.getHttpAuthCredentials(host, realm);
}
/**
* 保存给定主机和域的HTTP身份验证凭据,该方法为同步方法。
* @param host HTTP身份验证凭据应用的主机。
* @param realm HTTP身份验证凭据应用的域。
* @param username 用户名。
* @param password 密码。
*/
static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void {
webview.WebDataBase.saveHttpAuthCredentials(host, realm, username, password);
}
/**
* 判断是否存在任何已保存的HTTP身份验证凭据,该方法为同步方法。存在返回true,不存在返回false。
* @returns
*/
static existHttpAuthCredentials(): boolean {
return webview.WebDataBase.existHttpAuthCredentials();
}
/**
* 清除所有已保存的HTTP身份验证凭据,该方法为同步方法。
*/
static deleteHttpAuthCredentials(): void {
webview.WebDataBase.deleteHttpAuthCredentials();
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ArkWebHelper AST#class_body#Left { AST#property_declaration#Left private static context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //common.UIAbilityContext,上下文 AST#property_declaration#Left static debug : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right //是否是debug模式 AST#property_declaration#Left static tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'ArkWeb' AST#expression#Right ; AST#property_declaration#Right //日志Tag AST#property_declaration#Left static level : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left hilog . LogLevel AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . LogLevel AST#member_expression#Right AST#expression#Right . INFO AST#member_expression#Right AST#expression#Right //日志Level /**
* 初始化
* @param context UIAbilityContext
* @param debug 是否是debug模式
* @param tag 日志Tag
* @param level 日志Level
*/ AST#property_declaration#Right AST#method_declaration#Left static initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left debug : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'ArkWeb' AST#expression#Right AST#parameter#Right , AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left hilog . LogLevel AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . LogLevel AST#member_expression#Right AST#expression#Right . INFO AST#member_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . context AST#member_expression#Right = AST#expression#Left context AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . debug AST#member_expression#Right = AST#expression#Left debug AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . tag AST#member_expression#Right = AST#expression#Left tag AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . level AST#member_expression#Right = AST#expression#Left level AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . initializeWebEngine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . setWebDebuggingAccess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left debug AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DownloadUtils AST#expression#Right . onAbilityLifecycle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取上下文,common.UIAbilityContext
* @returns
*/ AST#method_declaration#Left static getContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left ArkWebHelper AST#expression#Right AST#unary_expression#Right AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . context AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right //兜底 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tools AST#expression#Right . logError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "请在UIAbility的onCreate方法中调用ArkWebHelper的init方法初始化!" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . context AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 预连接url,在加载url之前调用此API。
* @param url 预连接的url。
* @param preconnectable 是否进行预连接。如果preconnectable为true,则对url进行dns解析,socket建链预连接;如果preconnectable为false,则不做任何预连接操作。
* @param numSockets 要预连接的socket数。socket数目连接需要大于0,最多允许6个连接。
*/ AST#method_declaration#Left static prepareForPageLoad AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left preconnectable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left numSockets : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Array AST#expression#Right . isArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left url AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . prepareForPageLoad AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left preconnectable AST#expression#Right , AST#expression#Left numSockets AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . prepareForPageLoad AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left preconnectable AST#expression#Right , AST#expression#Left numSockets AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScript需要在loadUrl完成后,比如onPageEnd中调用。
* @param webController
* @param script JavaScript脚本
* @returns
*/ AST#method_declaration#Left static async runJavaScript AST#parameter_list#Left ( AST#parameter#Left webController : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left script : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webController AST#expression#Right . runJavaScript AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left script AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScriptExt需要在loadUrl完成后,比如onPageEnd中调用。
* @param webController
* @param script JavaScript脚本。
* @returns
*/ AST#method_declaration#Left static async runJavaScriptExt AST#parameter_list#Left ( AST#parameter#Left webController : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left script : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . JsMessageExt AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webController AST#expression#Right . runJavaScriptExt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left script AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 异步执行JavaScript方法
* @param webController
* @param funName 方法名
* @param param 方法参数
* @returns
*/ AST#method_declaration#Left static async runJavaScriptFun AST#parameter_list#Left ( AST#parameter#Left webController : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left funName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left param AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . runJavaScript AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left webController AST#expression#Right , AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left funName AST#expression#Right } AST#template_substitution#Right (' AST#template_substitution#Left $ { AST#expression#Left param AST#expression#Right } AST#template_substitution#Right ') ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . runJavaScript AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left webController AST#expression#Right , AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left funName AST#expression#Right } AST#template_substitution#Right () ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 以Promise方式异步获取指定url对应cookie的值。
* @param url 要获取的cookie所属的url,建议使用完整的url。
* @returns
*/ AST#method_declaration#Left static async fetchCookie AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . fetchCookie AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取指定url对应cookie的值。
* @param url 要获取的cookie所属的url,建议使用完整的url。
* @param incognito true表示获取隐私模式下webview的内存cookies,false表示正常非隐私模式下的cookies。
* @returns
*/ AST#method_declaration#Left static fetchCookieSync AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left incognito ? : 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . fetchCookieSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left incognito AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 以异步Promise方式为指定url设置单个cookie的值。
* @param url 要设置的cookie所属的url,建议使用完整的url。
* @param value 要设置的cookie的值。
*/ AST#method_declaration#Left static async configCookie AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . configCookie AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 为指定url设置单个cookie的值。
* @param url 要设置的cookie所属的url,建议使用完整的url。
* @param value 要设置的cookie的值。
* @param incognito true表示设置隐私模式下对应url的cookies,false表示设置正常非隐私模式下对应url的cookies。
*/ AST#method_declaration#Left static configCookieSync AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left incognito ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . configCookieSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left value AST#expression#Right , AST#expression#Left incognito AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 将当前存在内存中的cookie以Promise方法异步保存到磁盘中。
* @returns
*/ AST#method_declaration#Left static async saveCookieAsync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . saveCookieAsync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 设置WebCookieManager实例是否拥有发送和接收cookie的权限。
* @param accept 设置是否拥有发送和接收cookie的权限,默认为true。
*/ AST#method_declaration#Left static putAcceptCookieEnabled AST#parameter_list#Left ( AST#parameter#Left accept : 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_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . putAcceptCookieEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left accept AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取WebCookieManager实例是否拥有发送和接收cookie的权限。
* @returns
*/ AST#method_declaration#Left static isCookieAllowed 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_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . isCookieAllowed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 设置WebCookieManager实例是否拥有发送和接收第三方cookie的权限。
* @param accept 设置是否拥有发送和接收第三方cookie的权限,默认为false。
*/ AST#method_declaration#Left static putAcceptThirdPartyCookieEnabled AST#parameter_list#Left ( AST#parameter#Left accept : 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_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . putAcceptThirdPartyCookieEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left accept AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取WebCookieManager实例是否拥有发送和接收第三方cookie的权限。
* @returns
*/ AST#method_declaration#Left static isThirdPartyCookieAllowed 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_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . isThirdPartyCookieAllowed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取是否存在cookie。
* @param incognito true表示隐私模式下查询是否存在cookies,false表示正常非隐私模式下查询是否存在cookies。
* @returns
*/ AST#method_declaration#Left static existCookie AST#parameter_list#Left ( AST#parameter#Left incognito ? : 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . existCookie AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left incognito AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 异步promise方式清除所有cookie。
* @returns
*/ AST#method_declaration#Left static async clearAllCookies AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . clearAllCookies AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 清除所有cookie。
* @param incognito true表示清除隐私模式下webview的所有内存cookies,false表示清除正常非隐私模式下的持久化cookies。
*/ AST#method_declaration#Left static clearAllCookiesSync AST#parameter_list#Left ( AST#parameter#Left incognito ? : 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_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . clearAllCookiesSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left incognito AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 异步promise方式清除所有会话cookie。
* @returns
*/ AST#method_declaration#Left static async clearSessionCookie AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . clearSessionCookie AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 清除所有会话cookie。
*/ AST#method_declaration#Left static clearSessionCookieSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . clearSessionCookieSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 以Promise方式异步获取当前使用Web SQL数据库的所有源的信息。
* @returns
*/ AST#method_declaration#Left static async getOrigins AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebStorageOrigin AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebStorage AST#member_expression#Right AST#expression#Right . getOrigins AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 以Promise方式异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。
* @param origin 指定源的字符串索引
* @returns
*/ AST#method_declaration#Left static async getOriginQuota AST#parameter_list#Left ( AST#parameter#Left origin : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebStorage AST#member_expression#Right AST#expression#Right . getOriginQuota AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left origin AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 以Promise方式异步获取指定源的Web SQL数据库的存储量,存储量以字节为单位。
* @param origin 指定源的字符串索引
* @returns
*/ AST#method_declaration#Left static async getOriginUsage AST#parameter_list#Left ( AST#parameter#Left origin : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebStorage AST#member_expression#Right AST#expression#Right . getOriginUsage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left origin AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 清除指定源所使用的存储。
* @param origin 指定源的字符串索引,来自于getOrigins。
*/ AST#method_declaration#Left static deleteOrigin AST#parameter_list#Left ( AST#parameter#Left origin : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebStorage AST#member_expression#Right AST#expression#Right . deleteOrigin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left origin AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 清除Web SQL数据库当前使用的所有存储。
* @param incognito 清除Web SQL数据库当前使用的所有存储。
*/ AST#method_declaration#Left static deleteAllData AST#parameter_list#Left ( AST#parameter#Left incognito ? : 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_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebStorage AST#member_expression#Right AST#expression#Right . deleteAllData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left incognito AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 检索给定主机和域的HTTP身份验证凭据,该方法为同步方法。
* @param host HTTP身份验证凭据应用的主机。
* @param realm HTTP身份验证凭据应用的域。
* @returns
*/ AST#method_declaration#Left static getHttpAuthCredentials AST#parameter_list#Left ( AST#parameter#Left host : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left realm : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebDataBase AST#member_expression#Right AST#expression#Right . getHttpAuthCredentials AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left host AST#expression#Right , AST#expression#Left realm AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 保存给定主机和域的HTTP身份验证凭据,该方法为同步方法。
* @param host HTTP身份验证凭据应用的主机。
* @param realm HTTP身份验证凭据应用的域。
* @param username 用户名。
* @param password 密码。
*/ AST#method_declaration#Left static saveHttpAuthCredentials AST#parameter_list#Left ( AST#parameter#Left host : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left realm : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left username : 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#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebDataBase AST#member_expression#Right AST#expression#Right . saveHttpAuthCredentials AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left host AST#expression#Right , AST#expression#Left realm AST#expression#Right , AST#expression#Left username AST#expression#Right , AST#expression#Left password AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 判断是否存在任何已保存的HTTP身份验证凭据,该方法为同步方法。存在返回true,不存在返回false。
* @returns
*/ AST#method_declaration#Left static existHttpAuthCredentials 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_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebDataBase AST#member_expression#Right AST#expression#Right . existHttpAuthCredentials AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 清除所有已保存的HTTP身份验证凭据,该方法为同步方法。
*/ AST#method_declaration#Left static deleteHttpAuthCredentials AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebDataBase AST#member_expression#Right AST#expression#Right . deleteHttpAuthCredentials AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ArkWebHelper {
private static context: common.UIAbilityContext;
static debug: boolean = false;
static tag: string = 'ArkWeb';
static level: hilog.LogLevel = hilog.LogLevel.INFO
static initialize(context: common.UIAbilityContext, debug: boolean = false, tag: string = 'ArkWeb',
level: hilog.LogLevel = hilog.LogLevel.INFO) {
ArkWebHelper.context = context;
ArkWebHelper.debug = debug;
ArkWebHelper.tag = tag;
ArkWebHelper.level = level;
webview.WebviewController.initializeWebEngine();
webview.WebviewController.setWebDebuggingAccess(debug);
DownloadUtils.onAbilityLifecycle(ArkWebHelper.context);
}
static getContext(): common.UIAbilityContext {
if (!ArkWebHelper.context) {
ArkWebHelper.context = getContext() as common.UIAbilityContext;
Tools.logError("请在UIAbility的onCreate方法中调用ArkWebHelper的init方法初始化!");
}
return ArkWebHelper.context;
}
static prepareForPageLoad(url: string | string[], preconnectable: boolean = true, numSockets: number = 2) {
if (Array.isArray(url)) {
url.forEach((item) => webview.WebviewController.prepareForPageLoad(item, preconnectable, numSockets))
} else {
webview.WebviewController.prepareForPageLoad(url, preconnectable, numSockets);
}
}
static async runJavaScript(webController: webview.WebviewController, script: string): Promise<string> {
return webController.runJavaScript(script);
}
static async runJavaScriptExt(webController: webview.WebviewController, script: string | ArrayBuffer): Promise<webview.JsMessageExt> {
return webController.runJavaScriptExt(script);
}
static async runJavaScriptFun(webController: webview.WebviewController, funName: string, param?: string): Promise<string> {
if (param) {
return ArkWebHelper.runJavaScript(webController, `${funName}('${param}')`);
} else {
return ArkWebHelper.runJavaScript(webController, `${funName}()`);
}
}
static async fetchCookie(url: string): Promise<string> {
return await webview.WebCookieManager.fetchCookie(url);
}
static fetchCookieSync(url: string, incognito?: boolean): string {
return webview.WebCookieManager.fetchCookieSync(url, incognito);
}
static async configCookie(url: string, value: string): Promise<void> {
return await webview.WebCookieManager.configCookie(url, value);
}
static configCookieSync(url: string, value: string, incognito?: boolean) {
webview.WebCookieManager.configCookieSync(url, value, incognito);
}
static async saveCookieAsync(): Promise<void> {
return await webview.WebCookieManager.saveCookieAsync();
}
static putAcceptCookieEnabled(accept: boolean): void {
webview.WebCookieManager.putAcceptCookieEnabled(accept);
}
static isCookieAllowed(): boolean {
return webview.WebCookieManager.isCookieAllowed();
}
static putAcceptThirdPartyCookieEnabled(accept: boolean): void {
webview.WebCookieManager.putAcceptThirdPartyCookieEnabled(accept);
}
static isThirdPartyCookieAllowed(): boolean {
return webview.WebCookieManager.isThirdPartyCookieAllowed();
}
static existCookie(incognito?: boolean): boolean {
return webview.WebCookieManager.existCookie(incognito);
}
static async clearAllCookies(): Promise<void> {
return await webview.WebCookieManager.clearAllCookies();
}
static clearAllCookiesSync(incognito?: boolean): void {
webview.WebCookieManager.clearAllCookiesSync(incognito);
}
static async clearSessionCookie(): Promise<void> {
return await webview.WebCookieManager.clearSessionCookie();
}
static clearSessionCookieSync(): void {
webview.WebCookieManager.clearSessionCookieSync();
}
static async getOrigins(): Promise<Array<webview.WebStorageOrigin>> {
return await webview.WebStorage.getOrigins();
}
static async getOriginQuota(origin: string): Promise<number> {
return await webview.WebStorage.getOriginQuota(origin);
}
static async getOriginUsage(origin: string): Promise<number> {
return await webview.WebStorage.getOriginUsage(origin);
}
static deleteOrigin(origin: string): void {
webview.WebStorage.deleteOrigin(origin);
}
static deleteAllData(incognito?: boolean): void {
webview.WebStorage.deleteAllData(incognito);
}
static getHttpAuthCredentials(host: string, realm: string): Array<string> {
return webview.WebDataBase.getHttpAuthCredentials(host, realm);
}
static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void {
webview.WebDataBase.saveHttpAuthCredentials(host, realm, username, password);
}
static existHttpAuthCredentials(): boolean {
return webview.WebDataBase.existHttpAuthCredentials();
}
static deleteHttpAuthCredentials(): void {
webview.WebDataBase.deleteHttpAuthCredentials();
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L10-L308
|
b26fa1c83e2f10f37b78076272424e8415e2a201
|
gitee
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/utils/MyMath.ets
|
arkts
|
Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export default class MyMath {
/**
* Constant by which to multiply an angular value in radians to obtain an
* angular value in degrees.
*/
private static radians: number = 57.29577951308232;
/**
* Constant by which to multiply an angular value in degrees to obtain an
* angular value in radians.
*/
private static degrees: number = 0.017453292519943295;
/**
* Converts an angle measured in degrees to an approximately
* equivalent angle measured in radians. The conversion from
* degrees to radians is generally inexact.
*
* @param angdeg an angle, in degrees
* @return the measurement of the angle {@code angdeg}
* in radians.
*/
public static toRadians(ang: number): number {
return ang * MyMath.degrees;
}
/*
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0.
Params:
angrad – an angle, in radians
*/
public static toDegrees(ang: number) {
return ang * MyMath.radians
}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class MyMath AST#class_body#Left { /**
* Constant by which to multiply an angular value in radians to obtain an
* angular value in degrees.
*/ AST#property_declaration#Left private static radians : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 57.29577951308232 AST#expression#Right ; AST#property_declaration#Right /**
* Constant by which to multiply an angular value in degrees to obtain an
* angular value in radians.
*/ AST#property_declaration#Left private static degrees : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.017453292519943295 AST#expression#Right ; AST#property_declaration#Right /**
* Converts an angle measured in degrees to an approximately
* equivalent angle measured in radians. The conversion from
* degrees to radians is generally inexact.
*
* @param angdeg an angle, in degrees
* @return the measurement of the angle {@code angdeg}
* in radians.
*/ AST#method_declaration#Left public static toRadians AST#parameter_list#Left ( AST#parameter#Left ang : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ang AST#expression#Right * AST#expression#Left MyMath AST#expression#Right AST#binary_expression#Right AST#expression#Right . degrees AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /*
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0.
Params:
angrad – an angle, in radians
*/ AST#method_declaration#Left public static toDegrees AST#parameter_list#Left ( AST#parameter#Left ang : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ang AST#expression#Right * AST#expression#Left MyMath AST#expression#Right AST#binary_expression#Right AST#expression#Right . radians AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class MyMath {
private static radians: number = 57.29577951308232;
private static degrees: number = 0.017453292519943295;
public static toRadians(ang: number): number {
return ang * MyMath.degrees;
}
public static toDegrees(ang: number) {
return ang * MyMath.radians
}
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/MyMath.ets#L16-L50
|
ab2f9c77a52b224a68473e67352a765e97dca7dc
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/ContactTypes.ets
|
arkts
|
年龄分布接口
|
export interface AgeDistribution {
under18: number;
age18to30: number;
age31to50: number;
over50: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface AgeDistribution AST#object_type#Left { AST#type_member#Left under18 : 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 age18to30 : 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 age31to50 : 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 over50 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface AgeDistribution {
under18: number;
age18to30: number;
age31to50: number;
over50: number;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L9-L14
|
0029ee2813554e19dcd07594fcae8619f44effb1
|
github
|
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/core/router/Routes.ets
|
arkts
|
初始化路由表
|
export function initRoutes(): void {
// 注册所有路由
Router.registerRoute({
path: Routes.SPLASH,
name: '启动页',
needAuth: false
});
Router.registerRoute({
path: Routes.LOGIN,
name: '登录页',
needAuth: false
});
Router.registerRoute({
path: Routes.REGISTER,
name: '注册页',
needAuth: false
});
Router.registerRoute({
path: Routes.MAIN_TAB,
name: '主页',
needAuth: true
});
Router.registerRoute({
path: Routes.HOME,
name: '首页',
needAuth: true
});
Router.registerRoute({
path: Routes.PROFILE,
name: '我的',
needAuth: true
});
Router.registerRoute({
path: Routes.SETTINGS,
name: '设置',
needAuth: true
});
Router.registerRoute({
path: Routes.ABOUT,
name: '关于',
needAuth: false
});
}
|
AST#export_declaration#Left export AST#function_declaration#Left function initRoutes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 注册所有路由 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Router AST#expression#Right . registerRoute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Routes AST#expression#Right . SPLASH AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '启动页' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needAuth AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Router AST#expression#Right . registerRoute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Routes AST#expression#Right . LOGIN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '登录页' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needAuth AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Router AST#expression#Right . registerRoute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Routes AST#expression#Right . REGISTER AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '注册页' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needAuth AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Router AST#expression#Right . registerRoute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Routes AST#expression#Right . MAIN_TAB AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '主页' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needAuth AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Router AST#expression#Right . registerRoute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Routes AST#expression#Right . HOME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '首页' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needAuth AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Router AST#expression#Right . registerRoute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Routes AST#expression#Right . PROFILE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '我的' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needAuth AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Router AST#expression#Right . registerRoute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Routes AST#expression#Right . SETTINGS AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '设置' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needAuth AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Router AST#expression#Right . registerRoute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left path AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Routes AST#expression#Right . ABOUT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '关于' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left needAuth AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function initRoutes(): void {
Router.registerRoute({
path: Routes.SPLASH,
name: '启动页',
needAuth: false
});
Router.registerRoute({
path: Routes.LOGIN,
name: '登录页',
needAuth: false
});
Router.registerRoute({
path: Routes.REGISTER,
name: '注册页',
needAuth: false
});
Router.registerRoute({
path: Routes.MAIN_TAB,
name: '主页',
needAuth: true
});
Router.registerRoute({
path: Routes.HOME,
name: '首页',
needAuth: true
});
Router.registerRoute({
path: Routes.PROFILE,
name: '我的',
needAuth: true
});
Router.registerRoute({
path: Routes.SETTINGS,
name: '设置',
needAuth: true
});
Router.registerRoute({
path: Routes.ABOUT,
name: '关于',
needAuth: false
});
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Routes.ets#L40-L89
|
24b1056b01e31af14c35a393caed98e423c77a49
|
github
|
|
buqiuz/Account.git
|
b843a38c24a833a9a4386f63cffec5fa5dadc674
|
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/charts/ChartModel.ets
|
arkts
|
addViewportJob
|
Either posts a job immediately if the chart has already setup it's
dimensions or adds the job to the execution queue.
@param job
|
public addViewportJob(job: MoveViewJob) {
if (this.mViewPortHandler.hasChartDimens()) {
job.run();
} else {
this.mJobs.add(job);
}
}
|
AST#method_declaration#Left public addViewportJob AST#parameter_list#Left ( AST#parameter#Left job : AST#type_annotation#Left AST#primary_type#Left MoveViewJob AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . hasChartDimens AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left job AST#expression#Right . run AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mJobs AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left job AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public addViewportJob(job: MoveViewJob) {
if (this.mViewPortHandler.hasChartDimens()) {
job.run();
} else {
this.mJobs.add(job);
}
}
|
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/charts/ChartModel.ets#L294-L300
|
ebc54438f958ef8027454926ca31d241b258b947
|
github
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
|
arkts
|
获取用户特定分类的梦想列表
@param userId 用户ID
@param category 分类名称
@returns 梦想列表
|
export function getDreamsByUserIdAndCategory(userId: number, category: string): Promise<Dream[]> {
try {
return request<Dream[]>(RequestMethod.GET, `/dreams/user/${userId}/category/${category}`);
} catch (error) {
console.error(`获取用户${category}分类梦想列表失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`获取用户${category}分类梦想列表失败: ${error instanceof Error ? error.message : String(error)}`);
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getDreamsByUserIdAndCategory AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left category : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Dream [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Dream [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /dreams/user/ AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right /category/ AST#template_substitution#Left $ { AST#expression#Left category AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取用户 AST#template_substitution#Left $ { AST#expression#Left category AST#expression#Right } AST#template_substitution#Right 分类梦想列表失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取用户 AST#template_substitution#Left $ { AST#expression#Left category AST#expression#Right } AST#template_substitution#Right 分类梦想列表失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getDreamsByUserIdAndCategory(userId: number, category: string): Promise<Dream[]> {
try {
return request<Dream[]>(RequestMethod.GET, `/dreams/user/${userId}/category/${category}`);
} catch (error) {
console.error(`获取用户${category}分类梦想列表失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`获取用户${category}分类梦想列表失败: ${error instanceof Error ? error.message : String(error)}`);
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L463-L470
|
747333137ec9f95b8724e6b5ad37ef4947735232
|
github
|
|
openharmony/update_update_app
|
0157b7917e2f48e914b5585991e8b2f4bc25108a
|
feature/ota/src/main/ets/manager/StateManager.ets
|
arkts
|
状态--下载暂停
@since 2022-06-10
|
export class DownloadPause extends BaseState {
constructor() {
super();
this.actionSet.push(UpdateAction.SHOW_NEW_VERSION);
this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW);
this.actionSet.push(UpdateAction.RESUME);
this.state = UpdateState.DOWNLOAD_PAUSE;
this.downloadStateText = $r('app.string.download_status_download_pause');
this.buttonText = $r('app.string.continue');
this.buttonClickAction = UpdateAction.RESUME;
}
async notify(context?: common.Context, eventId?: update.EventId): Promise<void> {
if (!VersionUtils.isInNewVersionPage()) {
return;
}
if (this.otaStatus?.endReason) {
await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll();
switch (this.otaStatus?.endReason) {
case ErrorCode.NETWORK_ERROR:
if (eventId == update.EventId.EVENT_DOWNLOAD_PAUSE) {
DialogUtils.showDownloadNoNetworkDialog(context, this.otaStatus, eventId);
} else {
let message = await context.resourceManager.getString($r('app.string.network_err_toast').id);
ToastUtils.showToast(message);
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DownloadPause extends AST#type_annotation#Left AST#primary_type#Left BaseState AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . actionSet AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left UpdateAction AST#expression#Right . SHOW_NEW_VERSION AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . actionSet AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left UpdateAction AST#expression#Right . SHOW_PROCESS_VIEW AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . actionSet AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left UpdateAction AST#expression#Right . RESUME AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . state AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left UpdateState AST#expression#Right . DOWNLOAD_PAUSE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . downloadStateText AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.download_status_download_pause' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonText AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.continue' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonClickAction AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left UpdateAction AST#expression#Right . RESUME AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left async notify AST#parameter_list#Left ( AST#parameter#Left context ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventId ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left update . EventId AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left VersionUtils AST#expression#Right AST#unary_expression#Right AST#expression#Right . isInNewVersionPage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right if ( AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . otaStatus AST#member_expression#Right AST#expression#Right ?. endReason AST#member_expression#Right AST#expression#Right AST#ERROR#Left ) { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left UpgradeAdapter AST#expression#Right AST#await_expression#Right AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getNotifyInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. cancelAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . otaStatus AST#member_expression#Right AST#expression#Right ?. endReason AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right { AST#property_name#Left case AST#property_name#Right ErrorCode AST#ERROR#Right . NETWORK_ERROR AST#member_expression#Right AST#expression#Right AST#ERROR#Left : if AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left eventId AST#expression#Right == AST#expression#Left update AST#expression#Right AST#binary_expression#Right AST#expression#Right . EventId AST#member_expression#Right AST#expression#Right . EVENT_DOWNLOAD_PAUSE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left DialogUtils AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . showDownloadNoNetworkDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . otaStatus AST#member_expression#Right AST#expression#Right , AST#expression#Left eventId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; } else { AST#property_name#Left let AST#property_name#Right message = AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.network_err_toast' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right ; AST#method_declaration#Right AST#method_declaration#Left ToastUtils AST#ERROR#Left . showTo as t AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left message AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DownloadPause extends BaseState {
constructor() {
super();
this.actionSet.push(UpdateAction.SHOW_NEW_VERSION);
this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW);
this.actionSet.push(UpdateAction.RESUME);
this.state = UpdateState.DOWNLOAD_PAUSE;
this.downloadStateText = $r('app.string.download_status_download_pause');
this.buttonText = $r('app.string.continue');
this.buttonClickAction = UpdateAction.RESUME;
}
async notify(context?: common.Context, eventId?: update.EventId): Promise<void> {
if (!VersionUtils.isInNewVersionPage()) {
return;
}
if (this.otaStatus?.endReason) {
await UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll();
switch (this.otaStatus?.endReason) {
case ErrorCode.NETWORK_ERROR:
if (eventId == update.EventId.EVENT_DOWNLOAD_PAUSE) {
DialogUtils.showDownloadNoNetworkDialog(context, this.otaStatus, eventId);
} else {
let message = await context.resourceManager.getString($r('app.string.network_err_toast').id);
ToastUtils.showToast(message);
}
|
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L367-L392
|
3db7487d1d2d190ed1e10516d185f73de21bd792
|
gitee
|
|
huangwei021230/HarmonyFlow.git
|
427f918873b0c9efdc975ff4889726b1bfccc546
|
entry/src/main/ets/ime/text/Key/KeyHintConfiguration.ets
|
arkts
|
Enumeration representing different modes of key hints.
|
export enum KeyHintMode {
DISABLED,
ACCENT_PRIORITY,
HINT_PRIORITY
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum KeyHintMode AST#enum_body#Left { AST#enum_member#Left DISABLED AST#enum_member#Right , AST#enum_member#Left ACCENT_PRIORITY AST#enum_member#Right , AST#enum_member#Left HINT_PRIORITY AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum KeyHintMode {
DISABLED,
ACCENT_PRIORITY,
HINT_PRIORITY
}
|
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/ime/text/Key/KeyHintConfiguration.ets#L4-L8
|
0e76e14e956637373686e13be036f80639b4353c
|
github
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets
|
arkts
|
disableDashedHighlightLine
|
Disables the highlight-line to be drawn in dashed mode.
|
public disableDashedHighlightLine(): void {
this.mHighlightDashPathEffect = null;
}
|
AST#method_declaration#Left public disableDashedHighlightLine AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mHighlightDashPathEffect AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public disableDashedHighlightLine(): void {
this.mHighlightDashPathEffect = null;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets#L97-L99
|
5a90d4d563d8bc3294d633e686dd36b6cb3980a6
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets
|
arkts
|
selectCA
|
选择文件:CA、证书、私钥
|
selectCA() {
this.selectFile((file: string) => {
caFileUri = file;
this.canLoad = true;
})
}
|
AST#method_declaration#Left selectCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left caFileUri = AST#expression#Left file AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . canLoad AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
selectCA() {
this.selectFile((file: string) => {
caFileUri = file;
this.canLoad = true;
})
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets#L250-L255
|
070b5c87638897ce1059cca92baa8619a866566e
|
gitee
|
openharmony/applications_settings
|
aac607310ec30e30d1d54db2e04d055655f72730
|
product/phone/src/main/ets/pages/dateAndTime.ets
|
arkts
|
changeValue
|
modify date and time
|
changeValue() {
this.dateAndTimeList = [
{
settingSummary: '',
settingTitle: $r('app.string.date'),
settingValue: this.date,
settingAlias: this.dateMark,
settingArrow: this.image,
},
{
settingSummary: '',
settingTitle: $r('app.string.time'),
settingValue: this.time,
settingAlias: this.timeMark,
settingArrow: this.image,
}
]
}
|
AST#method_declaration#Left changeValue 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 . dateAndTimeList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left settingSummary AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left settingTitle AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.date' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left settingValue AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . date AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left settingAlias AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dateMark AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left settingArrow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . image AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left settingSummary AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left settingTitle AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.time' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left settingValue AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . time AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left settingAlias AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeMark AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left settingArrow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . image AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
changeValue() {
this.dateAndTimeList = [
{
settingSummary: '',
settingTitle: $r('app.string.date'),
settingValue: this.date,
settingAlias: this.dateMark,
settingArrow: this.image,
},
{
settingSummary: '',
settingTitle: $r('app.string.time'),
settingValue: this.time,
settingAlias: this.timeMark,
settingArrow: this.image,
}
]
}
|
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/dateAndTime.ets#L175-L192
|
9963fe6157e5ec2a27896e29c90b2a612e8548e9
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/utils/LunarCalendar.ets
|
arkts
|
getLunarFestival
|
获取传统农历节日
@param month 农历月
@param day 农历日
@param isLeapMonth 是否闰月
@returns 节日名称,无节日返回空字符串
|
static getLunarFestival(month: number, day: number, isLeapMonth: boolean = false): string {
if (isLeapMonth) {
return '';
}
const festivals: Record<string, string> = {
'1-1': '春节',
'1-2': '开年',
'1-3': '赤狗日',
'1-5': '破五',
'1-7': '人日',
'1-15': '元宵节',
'2-2': '龙抬头',
'2-19': '观音诞',
'3-3': '上巳节',
'4-8': '佛诞节',
'5-5': '端午节',
'6-6': '天贶节',
'6-19': '观音成道',
'6-24': '关公诞',
'7-7': '七夕节',
'7-15': '中元节',
'7-30': '地藏诞',
'8-15': '中秋节',
'9-9': '重阳节',
'9-19': '观音出家',
'10-1': '寒衣节',
'10-15': '下元节',
'11-17': '阿弥陀佛诞',
'12-8': '腊八节',
'12-23': '小年',
'12-24': '掸尘节'
};
const key = `${month}-${day}`;
const festival = festivals[key];
// 特殊处理除夕(腊月最后一天)
if (month === 12) {
const lunarYear = new Date().getFullYear();
const monthDays = ComprehensiveLunarDatabase.getMonthDays(lunarYear, 12);
if (day === monthDays) {
return '除夕';
}
}
return festival || '';
}
|
AST#method_declaration#Left static getLunarFestival 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 day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isLeapMonth AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left festivals : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left '1-1' AST#property_name#Right : AST#expression#Left '春节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '1-2' AST#property_name#Right : AST#expression#Left '开年' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '1-3' AST#property_name#Right : AST#expression#Left '赤狗日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '1-5' AST#property_name#Right : AST#expression#Left '破五' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '1-7' AST#property_name#Right : AST#expression#Left '人日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '1-15' AST#property_name#Right : AST#expression#Left '元宵节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '2-2' AST#property_name#Right : AST#expression#Left '龙抬头' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '2-19' AST#property_name#Right : AST#expression#Left '观音诞' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '3-3' AST#property_name#Right : AST#expression#Left '上巳节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '4-8' AST#property_name#Right : AST#expression#Left '佛诞节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '5-5' AST#property_name#Right : AST#expression#Left '端午节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '6-6' AST#property_name#Right : AST#expression#Left '天贶节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '6-19' AST#property_name#Right : AST#expression#Left '观音成道' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '6-24' AST#property_name#Right : AST#expression#Left '关公诞' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '7-7' AST#property_name#Right : AST#expression#Left '七夕节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '7-15' AST#property_name#Right : AST#expression#Left '中元节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '7-30' AST#property_name#Right : AST#expression#Left '地藏诞' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '8-15' AST#property_name#Right : AST#expression#Left '中秋节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '9-9' AST#property_name#Right : AST#expression#Left '重阳节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '9-19' AST#property_name#Right : AST#expression#Left '观音出家' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '10-1' AST#property_name#Right : AST#expression#Left '寒衣节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '10-15' AST#property_name#Right : AST#expression#Left '下元节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '11-17' AST#property_name#Right : AST#expression#Left '阿弥陀佛诞' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '12-8' AST#property_name#Right : AST#expression#Left '腊八节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '12-23' AST#property_name#Right : AST#expression#Left '小年' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '12-24' AST#property_name#Right : AST#expression#Left '掸尘节' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left month AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left day AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left festival = AST#expression#Left AST#subscript_expression#Left AST#expression#Left festivals AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 特殊处理除夕(腊月最后一天) AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right === AST#expression#Left 12 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lunarYear = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left monthDays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ComprehensiveLunarDatabase AST#expression#Right . getMonthDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lunarYear AST#expression#Right , AST#expression#Left 12 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left day AST#expression#Right === AST#expression#Left monthDays AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '除夕' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left festival AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getLunarFestival(month: number, day: number, isLeapMonth: boolean = false): string {
if (isLeapMonth) {
return '';
}
const festivals: Record<string, string> = {
'1-1': '春节',
'1-2': '开年',
'1-3': '赤狗日',
'1-5': '破五',
'1-7': '人日',
'1-15': '元宵节',
'2-2': '龙抬头',
'2-19': '观音诞',
'3-3': '上巳节',
'4-8': '佛诞节',
'5-5': '端午节',
'6-6': '天贶节',
'6-19': '观音成道',
'6-24': '关公诞',
'7-7': '七夕节',
'7-15': '中元节',
'7-30': '地藏诞',
'8-15': '中秋节',
'9-9': '重阳节',
'9-19': '观音出家',
'10-1': '寒衣节',
'10-15': '下元节',
'11-17': '阿弥陀佛诞',
'12-8': '腊八节',
'12-23': '小年',
'12-24': '掸尘节'
};
const key = `${month}-${day}`;
const festival = festivals[key];
if (month === 12) {
const lunarYear = new Date().getFullYear();
const monthDays = ComprehensiveLunarDatabase.getMonthDays(lunarYear, 12);
if (day === monthDays) {
return '除夕';
}
}
return festival || '';
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L396-L443
|
e8216d9827753c35544711138f808bd83a711d08
|
github
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/accuracy/flow_sensitive/loop_stmt/dowhile_body_002_F.ets
|
arkts
|
Introduction 循环结构-dowhile
|
export function dowhile_body_002_F(taint_src : string) {
let res = ""
do {
taint.Sink(res)
res = taint_src
}
|
AST#export_declaration#Left export AST#function_declaration#Left function dowhile_body_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_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res AST#ERROR#Left = AST#ERROR#Left AST#expression#Left "" AST#expression#Right do AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left taint AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left res AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right res AST#ERROR#Right = AST#expression#Left taint_src AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function dowhile_body_002_F(taint_src : string) {
let res = ""
do {
taint.Sink(res)
res = taint_src
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/flow_sensitive/loop_stmt/dowhile_body_002_F.ets#L6-L11
|
b78912408ffa28e67dc43307ecf5194860be6664
|
github
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
|
arkts
|
convertSelectedGoodsToCartList
|
将已选商品列表转换为购物车列表
@param {SelectedGoods[]} goodsList 已选商品列表
@returns {Cart[]} 购物车列表
|
private convertSelectedGoodsToCartList(goodsList: SelectedGoods[]): Cart[] {
// 按商品ID分组
const groupedMap = new Map<number, SelectedGoods[]>();
for (const goods of goodsList) {
const existingList = groupedMap.get(goods.goodsId);
if (existingList) {
existingList.push(goods);
} else {
groupedMap.set(goods.goodsId, [goods]);
}
}
// 为每个商品ID创建一个Cart对象
const result: Cart[] = [];
groupedMap.forEach((items: SelectedGoods[], goodsId: number) => {
const firstItem = items[0];
const cart = new Cart();
cart.goodsId = goodsId;
cart.goodsName = firstItem.goodsInfo?.title ?? "";
cart.goodsMainPic = firstItem.goodsInfo?.mainPic ?? "";
// 收集该商品的所有规格
const allSpecs: CartGoodsSpec[] = [];
for (const selectedItem of items) {
// 如果有规格信息,转换为CartGoodsSpec并添加
if (selectedItem.spec) {
const cartSpec = new CartGoodsSpec();
cartSpec.id = selectedItem.spec.id;
cartSpec.goodsId = selectedItem.spec.goodsId;
cartSpec.name = selectedItem.spec.name;
cartSpec.price = selectedItem.spec.price;
cartSpec.stock = selectedItem.spec.stock;
cartSpec.count = selectedItem.count;
cartSpec.images = selectedItem.spec.images;
allSpecs.push(cartSpec);
}
}
cart.spec = allSpecs;
result.push(cart);
});
return result;
}
|
AST#method_declaration#Left private convertSelectedGoodsToCartList AST#parameter_list#Left ( AST#parameter#Left goodsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SelectedGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 按商品ID分组 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left groupedMap = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SelectedGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const goods of AST#expression#Left goodsList AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left existingList = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedMap AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left existingList AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left existingList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goods AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedMap AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left goods AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left goods AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // 为每个商品ID创建一个Cart对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left groupedMap AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SelectedGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left firstItem = AST#expression#Left AST#subscript_expression#Left AST#expression#Left items AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cart = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Cart AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left goodsId AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsName AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left firstItem AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ?. title AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . goodsMainPic AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left firstItem AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ?. mainPic AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 收集该商品的所有规格 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left allSpecs : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CartGoodsSpec [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const selectedItem of AST#expression#Left items AST#expression#Right ) AST#block_statement#Left { // 如果有规格信息,转换为CartGoodsSpec并添加 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItem AST#expression#Right . spec AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cartSpec = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CartGoodsSpec AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cartSpec AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItem AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cartSpec AST#expression#Right . goodsId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItem AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cartSpec AST#expression#Right . name AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItem AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cartSpec AST#expression#Right . price AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItem AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . price AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cartSpec AST#expression#Right . stock AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItem AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . stock AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cartSpec AST#expression#Right . count AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItem AST#expression#Right . count AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cartSpec AST#expression#Right . images AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedItem AST#expression#Right . spec AST#member_expression#Right AST#expression#Right . images AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left allSpecs AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cartSpec AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cart AST#expression#Right . spec AST#member_expression#Right = AST#expression#Left allSpecs AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cart AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private convertSelectedGoodsToCartList(goodsList: SelectedGoods[]): Cart[] {
const groupedMap = new Map<number, SelectedGoods[]>();
for (const goods of goodsList) {
const existingList = groupedMap.get(goods.goodsId);
if (existingList) {
existingList.push(goods);
} else {
groupedMap.set(goods.goodsId, [goods]);
}
}
const result: Cart[] = [];
groupedMap.forEach((items: SelectedGoods[], goodsId: number) => {
const firstItem = items[0];
const cart = new Cart();
cart.goodsId = goodsId;
cart.goodsName = firstItem.goodsInfo?.title ?? "";
cart.goodsMainPic = firstItem.goodsInfo?.mainPic ?? "";
const allSpecs: CartGoodsSpec[] = [];
for (const selectedItem of items) {
if (selectedItem.spec) {
const cartSpec = new CartGoodsSpec();
cartSpec.id = selectedItem.spec.id;
cartSpec.goodsId = selectedItem.spec.goodsId;
cartSpec.name = selectedItem.spec.name;
cartSpec.price = selectedItem.spec.price;
cartSpec.stock = selectedItem.spec.stock;
cartSpec.count = selectedItem.count;
cartSpec.images = selectedItem.spec.images;
allSpecs.push(cartSpec);
}
}
cart.spec = allSpecs;
result.push(cart);
});
return result;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L135-L182
|
0f5b7095fecad596e26d5eaca6178cd8e3a5bb61
|
github
|
Rayawa/dashboard.git
|
9107efe7fb69a58d799a378b79ea8ffa4041cec8
|
entry/src/main/ets/common/utils.ets
|
arkts
|
解析输入字符串,提取链接、包名和app_id
@param inputStr 输入的字符串
@returns 包含links, pkgs, app_ids的对象
|
export function parseInputSplitLinksPkgsAndAppIds(inputStr: string): LinksPkgsAppIds {
inputStr = inputStr.trim();
if (!inputStr) {
return new LinksPkgsAppIdsClass();
}
// 支持更多分隔符:空格、换行、逗号、分号、竖线等
const parts = inputStr.split(/[\s\n,;|]+/);
const urlLike = /^https?:\/\/[^\s]+$/;
// 修改正则,将 C+数字 和其他包名分开匹配
const appIdRegex = /^[Cc]\d+$/; // 匹配 C 开头的数字(app_id)
const pkgNameRegex = /^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)+$/; // 匹配传统包名
// 用于从文本中提取的正则(非全局,用于search方法)
const extractPkgRegex = /[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)+/;
const extractAppIdRegex = /[Cc]\d+/;
const links: string[] = [];
const pkgs: string[] = [];
const app_ids: string[] = [];
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
let start = 0;
// 处理每个part,像Python代码一样扫描
while (start < part.length) {
// 匹配 app_id
const appIdMatch = part.slice(start).match(appIdRegex);
if (appIdMatch && appIdMatch.index === 0) {
const matchedAppId = appIdMatch[0];
app_ids.push(matchedAppId);
start += matchedAppId.length;
continue;
}
// 匹配 pkg_name
const pkgNameMatch = part.slice(start).match(pkgNameRegex);
if (pkgNameMatch && pkgNameMatch.index === 0) {
const matchedPkg = pkgNameMatch[0];
pkgs.push(matchedPkg);
start += matchedPkg.length;
continue;
}
// 匹配 url
const urlMatch = part.slice(start).match(urlLike);
if (urlMatch && urlMatch.index === 0) {
const matchedUrl = urlMatch[0];
links.push(matchedUrl);
// 从URL的path部分提取包名和app_id
try {
// 解析URL获取path部分
const urlObj = new URL(matchedUrl);
const pathname = urlObj.pathname;
// 如果pathname以/开头,去掉开头的/
let content = matchedUrl.slice(matchedUrl.indexOf(pathname));
if (content.startsWith("/")) {
content = content.substring(1);
}
if (content) {
// 从path内容中提取包名和app_id
let ls = 0;
while (ls < content.length) {
// 提取包名
const pkgExtractMatch = content.slice(ls).match(extractPkgRegex);
if (pkgExtractMatch && pkgExtractMatch.index != undefined) {
pkgs.push(pkgExtractMatch[0]);
ls += pkgExtractMatch.index + pkgExtractMatch[0].length;
continue;
}
// 提取app_id
const appIdExtractMatch = content.slice(ls).match(extractAppIdRegex);
if (appIdExtractMatch && appIdExtractMatch.index != undefined) {
app_ids.push(appIdExtractMatch[0]);
ls += appIdExtractMatch.index + appIdExtractMatch[0].length;
continue;
}
ls++;
}
}
} catch (e) {
// URL解析失败,跳过这个URL的解析
}
start += matchedUrl.length;
continue;
}
// 匹配其他包名
const otherPkgMatch = part.slice(start).match(extractPkgRegex);
if (otherPkgMatch && otherPkgMatch.index != undefined) {
pkgs.push(otherPkgMatch[0]);
start += otherPkgMatch.index + otherPkgMatch[0].length;
continue;
}
// 匹配其他 app_id
const otherAppIdMatch = part.slice(start).match(extractAppIdRegex);
if (otherAppIdMatch && otherAppIdMatch.index != undefined) {
app_ids.push(otherAppIdMatch[0]);
start += otherAppIdMatch.index + otherAppIdMatch[0].length;
continue;
}
// 如果没有匹配到,则跳过一个字符
start++;
}
}
// 按顺序的去重,保持输入的顺序
const finalLinks: string[] = [];
const finalPkgs: string[] = [];
const finalAppIds: string[] = [];
for (let i = 0; i < links.length; i++) {
const item = links[i];
if (!finalLinks.includes(item)) {
finalLinks.push(item);
}
}
for (let i = 0; i < pkgs.length; i++) {
const item = pkgs[i];
if (!finalPkgs.includes(item)) {
finalPkgs.push(item);
}
}
for (let i = 0; i < app_ids.length; i++) {
const item = app_ids[i];
if (!finalAppIds.includes(item)) {
finalAppIds.push(item);
}
}
return new LinksPkgsAppIdsClass(finalLinks, finalPkgs, finalAppIds);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function parseInputSplitLinksPkgsAndAppIds AST#parameter_list#Left ( AST#parameter#Left inputStr : 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 LinksPkgsAppIds AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left inputStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left inputStr AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left inputStr AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LinksPkgsAppIdsClass AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 支持更多分隔符:空格、换行、逗号、分号、竖线等 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left parts = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left inputStr AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#ERROR#Left \s\n AST#ERROR#Right , AST#ERROR#Left ; | AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right AST#ERROR#Left + / AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left urlLike AST#ERROR#Left = / ^ https ? AST#ERROR#Right : AST#ERROR#Left \ / \ / AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#ERROR#Left ^ \s AST#ERROR#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left + $ / ; AST#ERROR#Right // 修改正则,将 C+数字 和其他包名分开匹配 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left appIdRegex = AST#ERROR#Left / ^ AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#expression#Left Cc AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left \d + $ / AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right // 匹配 C 开头的数字(app_id) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pkgNameRegex = AST#ERROR#Left / ^ AST#ERROR#Right AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left zA AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Z AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left zA AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Z0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left _ AST#ERROR#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left * ( AST#ERROR#Left \ . AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left zA AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Z0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left _ AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right + AST#ERROR#Left ) AST#ERROR#Right + $ / AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right // 匹配传统包名 // 用于从文本中提取的正则(非全局,用于search方法) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left extractPkgRegex = AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left zA AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Z AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left zA AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Z0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left _ AST#ERROR#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left * ( AST#ERROR#Left \ . AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left zA AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Z0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left _ AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right + AST#ERROR#Left ) AST#ERROR#Right + / AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left extractAppIdRegex = AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#array_literal#Left [ AST#expression#Left Cc AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left \d + / AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left links : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pkgs : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left app_ids : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left parts AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left part = AST#expression#Left AST#subscript_expression#Left AST#expression#Left parts AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left start = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 处理每个part,像Python代码一样扫描 AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left start AST#expression#Right < AST#expression#Left part AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 匹配 app_id AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left appIdMatch = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left part AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left start AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left appIdRegex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left appIdMatch AST#expression#Right && AST#expression#Left appIdMatch AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left matchedAppId = AST#expression#Left AST#subscript_expression#Left AST#expression#Left appIdMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left app_ids AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left matchedAppId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left start += AST#expression#Left AST#member_expression#Left AST#expression#Left matchedAppId AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 匹配 pkg_name AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pkgNameMatch = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left part AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left start AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pkgNameRegex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left pkgNameMatch AST#expression#Right && AST#expression#Left pkgNameMatch AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left matchedPkg = AST#expression#Left AST#subscript_expression#Left AST#expression#Left pkgNameMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pkgs AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left matchedPkg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left start += AST#expression#Left AST#member_expression#Left AST#expression#Left matchedPkg AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 匹配 url AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left urlMatch = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left part AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left start AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left urlLike AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left urlMatch AST#expression#Right && AST#expression#Left urlMatch AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left matchedUrl = AST#expression#Left AST#subscript_expression#Left AST#expression#Left urlMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left links AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left matchedUrl AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 从URL的path部分提取包名和app_id AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 解析URL获取path部分 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left urlObj = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left URL AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left matchedUrl AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pathname = AST#expression#Left AST#member_expression#Left AST#expression#Left urlObj AST#expression#Right . pathname AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 如果pathname以/开头,去掉开头的/ AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left content = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left matchedUrl AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left matchedUrl AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pathname AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "/" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left content = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left content AST#expression#Right ) AST#block_statement#Left { // 从path内容中提取包名和app_id AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ls = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ls AST#expression#Right < AST#expression#Left content AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 提取包名 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pkgExtractMatch = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ls AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left extractPkgRegex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left pkgExtractMatch AST#expression#Right && AST#expression#Left pkgExtractMatch AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pkgs AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left pkgExtractMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ls += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pkgExtractMatch AST#expression#Right . index AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left pkgExtractMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 提取app_id AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left appIdExtractMatch = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ls AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left extractAppIdRegex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left appIdExtractMatch AST#expression#Right && AST#expression#Left appIdExtractMatch AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left app_ids AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left appIdExtractMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ls += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left appIdExtractMatch AST#expression#Right . index AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left appIdExtractMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left ls AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { // URL解析失败,跳过这个URL的解析 } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left start += AST#expression#Left AST#member_expression#Left AST#expression#Left matchedUrl AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 匹配其他包名 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left otherPkgMatch = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left part AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left start AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left extractPkgRegex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left otherPkgMatch AST#expression#Right && AST#expression#Left otherPkgMatch AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pkgs AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left otherPkgMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left start += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left otherPkgMatch AST#expression#Right . index AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left otherPkgMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 匹配其他 app_id AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left otherAppIdMatch = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left part AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left start AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left extractAppIdRegex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left otherAppIdMatch AST#expression#Right && AST#expression#Left otherAppIdMatch AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left app_ids AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left otherAppIdMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left start += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left otherAppIdMatch AST#expression#Right . index AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left otherAppIdMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 如果没有匹配到,则跳过一个字符 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left start AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // 按顺序的去重,保持输入的顺序 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left finalLinks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left finalPkgs : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left finalAppIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left links AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left item = AST#expression#Left AST#subscript_expression#Left AST#expression#Left links AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left finalLinks AST#expression#Right AST#unary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left finalLinks AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left pkgs AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left item = AST#expression#Left AST#subscript_expression#Left AST#expression#Left pkgs AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left finalPkgs AST#expression#Right AST#unary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left finalPkgs AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left app_ids AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left item = AST#expression#Left AST#subscript_expression#Left AST#expression#Left app_ids AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left finalAppIds AST#expression#Right AST#unary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left finalAppIds AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LinksPkgsAppIdsClass AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left finalLinks AST#expression#Right , AST#expression#Left finalPkgs AST#expression#Right , AST#expression#Left finalAppIds AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function parseInputSplitLinksPkgsAndAppIds(inputStr: string): LinksPkgsAppIds {
inputStr = inputStr.trim();
if (!inputStr) {
return new LinksPkgsAppIdsClass();
}
const parts = inputStr.split(/[\s\n,;|]+/);
const urlLike = /^https?:\/\/[^\s]+$/;
const appIdRegex = /^[Cc]\d+$/;
const pkgNameRegex = /^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)+$/;
const extractPkgRegex = /[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)+/;
const extractAppIdRegex = /[Cc]\d+/;
const links: string[] = [];
const pkgs: string[] = [];
const app_ids: string[] = [];
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
let start = 0;
while (start < part.length) {
const appIdMatch = part.slice(start).match(appIdRegex);
if (appIdMatch && appIdMatch.index === 0) {
const matchedAppId = appIdMatch[0];
app_ids.push(matchedAppId);
start += matchedAppId.length;
continue;
}
const pkgNameMatch = part.slice(start).match(pkgNameRegex);
if (pkgNameMatch && pkgNameMatch.index === 0) {
const matchedPkg = pkgNameMatch[0];
pkgs.push(matchedPkg);
start += matchedPkg.length;
continue;
}
const urlMatch = part.slice(start).match(urlLike);
if (urlMatch && urlMatch.index === 0) {
const matchedUrl = urlMatch[0];
links.push(matchedUrl);
try {
const urlObj = new URL(matchedUrl);
const pathname = urlObj.pathname;
let content = matchedUrl.slice(matchedUrl.indexOf(pathname));
if (content.startsWith("/")) {
content = content.substring(1);
}
if (content) {
let ls = 0;
while (ls < content.length) {
const pkgExtractMatch = content.slice(ls).match(extractPkgRegex);
if (pkgExtractMatch && pkgExtractMatch.index != undefined) {
pkgs.push(pkgExtractMatch[0]);
ls += pkgExtractMatch.index + pkgExtractMatch[0].length;
continue;
}
const appIdExtractMatch = content.slice(ls).match(extractAppIdRegex);
if (appIdExtractMatch && appIdExtractMatch.index != undefined) {
app_ids.push(appIdExtractMatch[0]);
ls += appIdExtractMatch.index + appIdExtractMatch[0].length;
continue;
}
ls++;
}
}
} catch (e) {
}
start += matchedUrl.length;
continue;
}
const otherPkgMatch = part.slice(start).match(extractPkgRegex);
if (otherPkgMatch && otherPkgMatch.index != undefined) {
pkgs.push(otherPkgMatch[0]);
start += otherPkgMatch.index + otherPkgMatch[0].length;
continue;
}
const otherAppIdMatch = part.slice(start).match(extractAppIdRegex);
if (otherAppIdMatch && otherAppIdMatch.index != undefined) {
app_ids.push(otherAppIdMatch[0]);
start += otherAppIdMatch.index + otherAppIdMatch[0].length;
continue;
}
start++;
}
}
const finalLinks: string[] = [];
const finalPkgs: string[] = [];
const finalAppIds: string[] = [];
for (let i = 0; i < links.length; i++) {
const item = links[i];
if (!finalLinks.includes(item)) {
finalLinks.push(item);
}
}
for (let i = 0; i < pkgs.length; i++) {
const item = pkgs[i];
if (!finalPkgs.includes(item)) {
finalPkgs.push(item);
}
}
for (let i = 0; i < app_ids.length; i++) {
const item = app_ids[i];
if (!finalAppIds.includes(item)) {
finalAppIds.push(item);
}
}
return new LinksPkgsAppIdsClass(finalLinks, finalPkgs, finalAppIds);
}
|
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/utils.ets#L31-L173
|
65a778ef79b5e036f1f8a6fbbe6e40e08a6a65a2
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets
|
arkts
|
addData
|
Add data to targetData.
@param Data of the RecordItemBean type to be added.
|
addData(data: TaskItemViewModel) {
if (!data) {
Logger.error(TAG, 'addData error because data is: ' + data);
return;
}
this.targetData.push(data);
}
|
AST#method_declaration#Left addData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TaskItemViewModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left data AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'addData error because data is: ' AST#expression#Right + AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetData AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
addData(data: TaskItemViewModel) {
if (!data) {
Logger.error(TAG, 'addData error because data is: ' + data);
return;
}
this.targetData.push(data);
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets#L62-L68
|
cbfe81e6fe8069154dbac326b0f19d1c40f33e6b
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets
|
arkts
|
prepared
|
video component prepared callback
|
prepared(duration: number) {
this.durationTime = duration;
let second: number = duration % COMMON_NUM_MINUTE;
let min: number = Number.parseInt((duration / COMMON_NUM_MINUTE).toString());
let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min;
let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : second;
this.durationStringTime = `${head}${SPLIT}${end}`;
this.flag = true;
}
|
AST#method_declaration#Left prepared AST#parameter_list#Left ( AST#parameter#Left duration : 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . durationTime AST#member_expression#Right = AST#expression#Left duration AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left second : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left duration AST#expression#Right % AST#expression#Left COMMON_NUM_MINUTE AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left duration AST#expression#Right / AST#expression#Left COMMON_NUM_MINUTE AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left head = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right < AST#expression#Left COMMON_NUM_DOUBLE AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left ZERO_STR AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left min AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right : AST#expression#Left min AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left end = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left second AST#expression#Right < AST#expression#Left COMMON_NUM_DOUBLE AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left ZERO_STR AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left second AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right : AST#expression#Left second AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . durationStringTime AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left head AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left SPLIT AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left end AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flag AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
prepared(duration: number) {
this.durationTime = duration;
let second: number = duration % COMMON_NUM_MINUTE;
let min: number = Number.parseInt((duration / COMMON_NUM_MINUTE).toString());
let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min;
let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : second;
this.durationStringTime = `${head}${SPLIT}${end}`;
this.flag = true;
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets#L87-L95
|
7d40bd5850a490c40c0643165319324b9d829d89
|
gitee
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_tabs.ets
|
arkts
|
get_all_match_domains
|
Gets a list of all tabs' domains.
@returns A string[][] array, the [scheme, domain].
|
get_all_match_domains() {
let match: string[][] = [];
for (let index = 0; index < this.Tabs.length; index++) {
match.push(match_domain(this.Tabs[index].url));
}
return match;
}
|
AST#method_declaration#Left get_all_match_domains AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left match : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . Tabs AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left match AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left match_domain AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Tabs AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . url AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left match AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
get_all_match_domains() {
let match: string[][] = [];
for (let index = 0; index < this.Tabs.length; index++) {
match.push(match_domain(this.Tabs[index].url));
}
return match;
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L584-L591
|
6c18c75d067d55bdb3be63a2eca06684eedbfc2c
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/buffer/AbstractBuffer.ets
|
arkts
|
setPhases
|
Set the phases used for animations.
@param phaseX
@param phaseY
|
public setPhases(phaseX: number, phaseY: number): void {
this.phaseX = phaseX;
this.phaseY = phaseY;
}
|
AST#method_declaration#Left public setPhases AST#parameter_list#Left ( AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phaseX AST#member_expression#Right = AST#expression#Left phaseX AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phaseY AST#member_expression#Right = AST#expression#Left phaseY AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setPhases(phaseX: number, phaseY: number): void {
this.phaseX = phaseX;
this.phaseY = phaseY;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/buffer/AbstractBuffer.ets#L78-L81
|
749e8be545ada78fd86fcbf3239778624ec29d00
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/services/storage/PreferencesService.ets
|
arkts
|
putNumber
|
存储数字值
@param key 键
@param value 值
|
async putNumber(key: string, value: number): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.put(key, value);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to put number: ${businessError.message}`);
throw new Error(businessError.message);
}
}
|
AST#method_declaration#Left async putNumber 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 number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkInitialized AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dataPreferences AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dataPreferences AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . flush AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left businessError = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to put number: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async putNumber(key: string, value: number): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.put(key, value);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to put number: ${businessError.message}`);
throw new Error(businessError.message);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L98-L108
|
f3d47d371207d7e28c3a2cf1af2c3e8af9115485
|
github
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/utils/Logger.ets
|
arkts
|
error
|
输出错误日志
@param message 日志信息
|
public static error(message: string): void {
console.error(`[${Logger.TAG}] ${message}`);
}
|
AST#method_declaration#Left public static error AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ] AST#template_substitution#Left $ { AST#expression#Left message AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static error(message: string): void {
console.error(`[${Logger.TAG}] ${message}`);
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/utils/Logger.ets#L27-L29
|
0eb40a070c3a1729880beafc9d83bdc5fc02816a
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleUseGlobalVar.ets
|
arkts
|
此时可能预期全局变量someGlobalVar的值为100
|
export function useGlobalVar() {
console.log(data1);
console.log(globalThis.someGlobalVar); // 此时由于main.ets中加载了sideEffectModule模块,someGlobalVar的值已经被改为200
}
|
AST#export_declaration#Left export AST#function_declaration#Left function useGlobalVar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left globalThis AST#expression#Right . someGlobalVar AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 此时由于main.ets中加载了sideEffectModule模块,someGlobalVar的值已经被改为200 } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function useGlobalVar() {
console.log(data1);
console.log(globalThis.someGlobalVar);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleUseGlobalVar.ets#L19-L22
|
b5fb7547b35b1626f3f21077220ba5f3dbd0d4a4
|
gitee
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.file.AlbumPickerComponent.d.ets
|
arkts
|
AlbumInfo: include album uri
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12
|
export declare class AlbumInfo {
/**
* Album uri
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
uri?: string;
/**
* Album name
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
albumName?: string;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class AlbumInfo AST#class_body#Left { /**
* Album uri
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#property_declaration#Left uri ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Album name
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#property_declaration#Left albumName ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class AlbumInfo {
uri?: string;
albumName?: string;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.AlbumPickerComponent.d.ets#L131-L151
|
6a892483bab1bd4621b6aff3ea09efe805c9f975
|
gitee
|
|
kumaleap/ArkSwipeDeck.git
|
5afa77b9b2a2a531595d31f895c54a3371e4249a
|
library/src/main/ets/utils/AnimationUtils.ets
|
arkts
|
createSpringCurve
|
创建弹簧曲线动画
@param stiffness - 刚度
@param damping - 阻尼
@param mass - 质量
@returns 弹簧曲线
|
static createSpringCurve(
stiffness: number = AnimationConstants.SPRING_STIFFNESS,
damping: number = AnimationConstants.SPRING_DAMPING,
mass: number = AnimationConstants.SPRING_MASS
): ICurve {
return curves.springCurve(stiffness, damping, mass, 0);
}
|
AST#method_declaration#Left static createSpringCurve AST#parameter_list#Left ( AST#parameter#Left stiffness : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AnimationConstants AST#expression#Right . SPRING_STIFFNESS AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left damping : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AnimationConstants AST#expression#Right . SPRING_DAMPING AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left mass : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AnimationConstants AST#expression#Right . SPRING_MASS AST#member_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ICurve AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left curves AST#expression#Right . springCurve AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left stiffness AST#expression#Right , AST#expression#Left damping AST#expression#Right , AST#expression#Left mass AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static createSpringCurve(
stiffness: number = AnimationConstants.SPRING_STIFFNESS,
damping: number = AnimationConstants.SPRING_DAMPING,
mass: number = AnimationConstants.SPRING_MASS
): ICurve {
return curves.springCurve(stiffness, damping, mass, 0);
}
|
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/AnimationUtils.ets#L26-L32
|
001cb780e04f3451b4489a06f6a5d838244fa9ca
|
github
|
L1rics06/arkTS-.git
|
991fd131bfdb11e2933152133c97453d86092ac0
|
entry/src/main/ets/pages/NetworkUtil.ets
|
arkts
|
mergeHeaders
|
合并请求头
|
static mergeHeaders(contentType: string): Record<string, string> {
const headers: Record<string, string> = {
"Content-Type": contentType,
"token": authToken
};
const authHeader = NetworkUtil.getAuthHeader();
if (authHeader.Authorization) {
headers.Authorization = authHeader.Authorization;
}
return headers;
}
|
AST#method_declaration#Left static mergeHeaders AST#parameter_list#Left ( AST#parameter#Left contentType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left headers : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "Content-Type" AST#property_name#Right : AST#expression#Left contentType AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "token" AST#property_name#Right : AST#expression#Left authToken AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left authHeader = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NetworkUtil AST#expression#Right . getAuthHeader AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left authHeader AST#expression#Right . Authorization AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left headers AST#expression#Right . Authorization AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left authHeader AST#expression#Right . Authorization AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left headers AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static mergeHeaders(contentType: string): Record<string, string> {
const headers: Record<string, string> = {
"Content-Type": contentType,
"token": authToken
};
const authHeader = NetworkUtil.getAuthHeader();
if (authHeader.Authorization) {
headers.Authorization = authHeader.Authorization;
}
return headers;
}
|
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L252-L264
|
145b5d771e42907b1badfde167440d182ec0eb7d
|
github
|
euler1129/Cloud-flash-payment.git
|
dfb70c1c67b3b69447f4384661e16b60f40495de
|
entry/src/main/ets/pages/card/components/publicComp/SubHead.ets
|
arkts
|
模块的头部
|
@Builder export default function SubHead (name: string, desc: string, right?: string, callBack?:()=>void) {
Row() {
Row() {
Text(name)
.fontWeight(FontWeight.Bold)
.fontSize(16)
.margin({right: 10})
Text(`| ${desc}`).fontSize(10).fontColor('#999')
}
Row() {
Text(`${right} `).fontSize(10)
Image($r('app.media.fragmentation_ic_right')).width(5)
}
.height(40)
.visibility(right ? Visibility.Visible : Visibility.Hidden)
.onClick(()=>{
callBack()
})
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export default AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#function_expression#Left function SubHead AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left desc : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left right ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callBack ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Row AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left Row AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Text AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontWeight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . margin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Text AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` | AST#template_substitution#Left $ { AST#expression#Left desc AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#999' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Row AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left { AST#property_name#Left Text AST#property_name#Right ( AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Image AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.fragmentation_ic_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 40 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . visibility AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callBack AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } AST#ERROR#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '100%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . justifyContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#decorated_export_declaration#Right
|
@Builder export default function SubHead (name: string, desc: string, right?: string, callBack?:()=>void) {
Row() {
Row() {
Text(name)
.fontWeight(FontWeight.Bold)
.fontSize(16)
.margin({right: 10})
Text(`| ${desc}`).fontSize(10).fontColor('#999')
}
Row() {
Text(`${right} `).fontSize(10)
Image($r('app.media.fragmentation_ic_right')).width(5)
}
.height(40)
.visibility(right ? Visibility.Visible : Visibility.Hidden)
.onClick(()=>{
callBack()
})
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
|
https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/card/components/publicComp/SubHead.ets#L2-L22
|
54a276fdca40aecf5bc966e882711fc5f9697978
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/game/GameificationService.ets
|
arkts
|
getAchievements
|
获取成就列表
|
getAchievements(includeHidden: boolean = false): Achievement[] {
if (!this.userGameData) {
return [];
}
return this.userGameData.achievements.filter(achievement =>
includeHidden || !achievement.isHidden || achievement.isUnlocked
);
}
|
AST#method_declaration#Left getAchievements AST#parameter_list#Left ( AST#parameter#Left includeHidden : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Achievement [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . userGameData AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userGameData AST#member_expression#Right AST#expression#Right . achievements AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left achievement => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left includeHidden AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left achievement AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . isHidden AST#member_expression#Right AST#expression#Right || AST#expression#Left achievement AST#expression#Right AST#binary_expression#Right AST#expression#Right . isUnlocked AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getAchievements(includeHidden: boolean = false): Achievement[] {
if (!this.userGameData) {
return [];
}
return this.userGameData.achievements.filter(achievement =>
includeHidden || !achievement.isHidden || achievement.isUnlocked
);
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L450-L458
|
4f009e183a5626eaa9e010f160e074f77be8949a
|
github
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/services/TextToSpeechService.ets
|
arkts
|
cleanTextForTTS
|
清理文本用于TTS播放
移除emoji、markdown格式等不适合朗读的内容
|
private cleanTextForTTS(text: string): string {
let cleaned = text;
// 移除emoji(保留基本字符)
cleaned = cleaned.replace(/[\u{1F600}-\u{1F64F}]/gu, ''); // 表情
cleaned = cleaned.replace(/[\u{1F300}-\u{1F5FF}]/gu, ''); // 符号和图形
cleaned = cleaned.replace(/[\u{1F680}-\u{1F6FF}]/gu, ''); // 交通工具
cleaned = cleaned.replace(/[\u{2600}-\u{26FF}]/gu, ''); // 杂项符号
cleaned = cleaned.replace(/[\u{2700}-\u{27BF}]/gu, ''); // 装饰符号
// 移除markdown格式
cleaned = cleaned.replace(/\*\*(.+?)\*\*/g, '$1'); // 粗体
cleaned = cleaned.replace(/\*(.+?)\*/g, '$1'); // 斜体
cleaned = cleaned.replace(/`(.+?)`/g, '$1'); // 代码
cleaned = cleaned.replace(/#+\s/g, ''); // 标题
// 移除URL
cleaned = cleaned.replace(/https?:\/\/[^\s]+/g, '');
// 移除多余空白
cleaned = cleaned.replace(/\n{2,}/g, '。');
cleaned = cleaned.replace(/\n/g, ',');
cleaned = cleaned.trim();
// 增加长度限制到500字符,更好地支持长回复
if (cleaned.length > 500) {
// 尝试在句号处截断
const sentences = cleaned.split(/[。!?]/);
let result = '';
for (const sentence of sentences) {
if ((result + sentence).length <= 500) {
result += sentence + '。';
} else {
break;
}
}
cleaned = result || cleaned.substring(0, 500);
}
return cleaned;
}
|
AST#method_declaration#Left private cleanTextForTTS AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cleaned = AST#expression#Left text AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 移除emoji(保留基本字符) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#array_literal#Left [ AST#ERROR#Left \u AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 1 AST#property_name#Right F AST#property_name#Left 600 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right - AST#ERROR#Left \u AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 1 AST#property_name#Right F AST#property_name#Left 64 AST#property_name#Right F AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right / AST#expression#Left gu AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 表情 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#array_literal#Left [ AST#ERROR#Left \u AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 1 AST#property_name#Right F AST#property_name#Left 300 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right - AST#ERROR#Left \u AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 1 AST#property_name#Right F AST#property_name#Left 5 AST#property_name#Right FF AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right / AST#expression#Left gu AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 符号和图形 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#array_literal#Left [ AST#ERROR#Left \u AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 1 AST#property_name#Right F AST#property_name#Left 680 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right - AST#ERROR#Left \u AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 1 AST#property_name#Right F AST#property_name#Left 6 AST#property_name#Right FF AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right / AST#expression#Left gu AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 交通工具 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#array_literal#Left [ AST#ERROR#Left \u { AST#property_name#Left 2600 AST#property_name#Right } AST#ERROR#Right AST#expression#Left AST#unary_expression#Left - AST#ERROR#Left \u AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 26 AST#property_name#Right FF AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right / AST#expression#Left gu AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 杂项符号 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#array_literal#Left [ AST#ERROR#Left \u { AST#property_name#Left 2700 AST#property_name#Right } AST#ERROR#Right AST#expression#Left AST#unary_expression#Left - AST#ERROR#Left \u AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 27 AST#property_name#Right BF AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right / AST#expression#Left gu AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 装饰符号 // 移除markdown格式 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / \ * \ * AST#parameter_list#Left ( AST#ERROR#Left . + ? AST#ERROR#Right ) AST#parameter_list#Right \ * \ AST#ERROR#Right * AST#expression#Left AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left '$1' AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right // 粗体 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / \ * AST#parameter_list#Left ( AST#ERROR#Left . + ? AST#ERROR#Right ) AST#parameter_list#Right \ AST#ERROR#Right * AST#expression#Left AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left '$1' AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right // 斜体 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` (.+?) ` AST#template_literal#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '$1' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 代码 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / AST#ERROR#Left # AST#ERROR#Right + \s AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left '' AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right // 标题 // 移除URL AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left https AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#expression#Right AST#ERROR#Left : \ / \ / [ ^ AST#ERROR#Left \s ] AST#ERROR#Right + AST#ERROR#Right / AST#ERROR#Left g , AST#ERROR#Right AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right // 移除多余空白 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \n AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 2 AST#property_name#Right AST#ERROR#Right , } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left '。' AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / \n AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left , AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left ',' AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 增加长度限制到500字符,更好地支持长回复 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 500 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 尝试在句号处截断 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sentences = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cleaned AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#expression#Left AST#array_literal#Left [ AST#ERROR#Left 。!? AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right / AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const sentence of AST#expression#Left sentences AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left result AST#expression#Right + AST#expression#Left sentence AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right <= AST#expression#Left 500 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result += AST#expression#Left AST#binary_expression#Left AST#expression#Left sentence AST#expression#Right + AST#expression#Left '。' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cleaned = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left result AST#expression#Right || AST#expression#Left cleaned AST#expression#Right AST#binary_expression#Right AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 500 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left cleaned AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private cleanTextForTTS(text: string): string {
let cleaned = text;
cleaned = cleaned.replace(/[\u{1F600}-\u{1F64F}]/gu, '');
cleaned = cleaned.replace(/[\u{1F300}-\u{1F5FF}]/gu, '');
cleaned = cleaned.replace(/[\u{1F680}-\u{1F6FF}]/gu, '');
cleaned = cleaned.replace(/[\u{2600}-\u{26FF}]/gu, '');
cleaned = cleaned.replace(/[\u{2700}-\u{27BF}]/gu, '');
cleaned = cleaned.replace(/\*\*(.+?)\*\*/g, '$1');
cleaned = cleaned.replace(/\*(.+?)\*/g, '$1');
cleaned = cleaned.replace(/`(.+?)`/g, '$1');
cleaned = cleaned.replace(/#+\s/g, '');
cleaned = cleaned.replace(/https?:\/\/[^\s]+/g, '');
cleaned = cleaned.replace(/\n{2,}/g, '。');
cleaned = cleaned.replace(/\n/g, ',');
cleaned = cleaned.trim();
if (cleaned.length > 500) {
const sentences = cleaned.split(/[。!?]/);
let result = '';
for (const sentence of sentences) {
if ((result + sentence).length <= 500) {
result += sentence + '。';
} else {
break;
}
}
cleaned = result || cleaned.substring(0, 500);
}
return cleaned;
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L300-L340
|
1f216c5b807b2584a494b669724c83a5d42b8c89
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/SettingDialog.ets
|
arkts
|
getReferenceLineBol
|
Persist the reference line, enter again to determine if the switch is turned on
|
getReferenceLineBol(bol: boolean) {
this.settingDataObj.referenceLineBol = bol;
this.referenceLineBol = bol;
}
|
AST#method_declaration#Left getReferenceLineBol AST#parameter_list#Left ( AST#parameter#Left bol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settingDataObj AST#member_expression#Right AST#expression#Right . referenceLineBol AST#member_expression#Right = AST#expression#Left bol AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . referenceLineBol AST#member_expression#Right = AST#expression#Left bol AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
getReferenceLineBol(bol: boolean) {
this.settingDataObj.referenceLineBol = bol;
this.referenceLineBol = bol;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/SettingDialog.ets#L54-L57
|
1418a30d1c93f990805b68ae56f3e786389af9f6
|
gitee
|
YShelter/Accouting_ArkTS.git
|
8c663c85f2c11738d4eabf269c23dc1ec84eb013
|
entry/src/main/ets/view/Home/WeekCalendarComponent.ets
|
arkts
|
默认滑动宽度后切换页面
|
build() {
Row() {
Column() {
Row() {
this.ArrowIcon(false) // 左箭头
BalanceText({
title: this.homeStore.dateTitle,
fontSize: $r('app.float.default_16')
})
this.ArrowIcon(true) // 右箭头
}
.justifyContent(FlexAlign.Center)
.onClick(() => {
DatePickerDialog.show({
start: new Date('2020-1-1'),
end: new Date('2031-12-31'),
selected: this.homeStore.currentDate,
onAccept: (value: DatePickerResult) => {
let selectedDate = new Date() as Date;
selectedDate.setFullYear(value.year, value.month, value.day);
this.homeStore.setSelectedShowDate(selectedDate.getTime());
}
})
})
}
.borderRadius($r('app.float.default_24'))
.backgroundColor($r('app.color.white'))
.width(Const.THOUSANDTH_1000)
.height(Const.THOUSANDTH_1000)
.justifyContent(FlexAlign.Center)
}
.width(Const.THOUSANDTH_1000)
.height(Const.THOUSANDTH_300)
.padding(Const.THOUSANDTH_33)
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ArrowIcon AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 左箭头 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left BalanceText ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . homeStore AST#member_expression#Right AST#expression#Right . dateTitle AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fontSize : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.default_16' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ArrowIcon AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 右箭头 } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DatePickerDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left start AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '2020-1-1' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left end AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '2031-12-31' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . homeStore AST#member_expression#Right AST#expression#Right . currentDate AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAccept AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left DatePickerResult AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left selectedDate = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedDate AST#expression#Right . setFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . year AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . month AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . day AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . homeStore AST#member_expression#Right AST#expression#Right . setSelectedShowDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left selectedDate AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.default_24' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . THOUSANDTH_1000 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . THOUSANDTH_1000 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . THOUSANDTH_1000 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . THOUSANDTH_300 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . THOUSANDTH_33 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Row() {
Column() {
Row() {
this.ArrowIcon(false)
BalanceText({
title: this.homeStore.dateTitle,
fontSize: $r('app.float.default_16')
})
this.ArrowIcon(true)
}
.justifyContent(FlexAlign.Center)
.onClick(() => {
DatePickerDialog.show({
start: new Date('2020-1-1'),
end: new Date('2031-12-31'),
selected: this.homeStore.currentDate,
onAccept: (value: DatePickerResult) => {
let selectedDate = new Date() as Date;
selectedDate.setFullYear(value.year, value.month, value.day);
this.homeStore.setSelectedShowDate(selectedDate.getTime());
}
})
})
}
.borderRadius($r('app.float.default_24'))
.backgroundColor($r('app.color.white'))
.width(Const.THOUSANDTH_1000)
.height(Const.THOUSANDTH_1000)
.justifyContent(FlexAlign.Center)
}
.width(Const.THOUSANDTH_1000)
.height(Const.THOUSANDTH_300)
.padding(Const.THOUSANDTH_33)
}
|
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/Home/WeekCalendarComponent.ets#L17-L51
|
9a9d32d14843b9f9b67f8c6497156454cf4bb1fd
|
github
|
|
Lateautumn00/HarmonyOS_WeChat.git
|
88993b308d5018c11d4e6ddf7838a96c6384201c
|
entry/src/main/ets/pages/Chat.ets
|
arkts
|
getListAll
|
列表的每一列 群聊天
|
@Builder getListAll(myCode:string,item:List){
Flex({justifyContent:FlexAlign.Start,alignItems:ItemAlign.Center,direction:myCode==item.code?FlexDirection.RowReverse:FlexDirection.Row}){
Image(item.image).width(50).height(50).borderRadius(50).margin({right:10,left:10})
Column(){
if(myCode!==item.code){
Row(){
Text(item.name)
}
.justifyContent(FlexAlign.Start)
.padding({bottom:10})
}
Row(){
Text(item.content).fontSize(18).fontWeight(FontWeight.Bold)
}
.constraintSize({minWidth:100,minHeight:60})
.backgroundColor(myCode==item.code?$r('app.color.wx_green'):$r('app.color.wx_white'))
.justifyContent(myCode==item.code?FlexAlign.End:FlexAlign.Start)
.padding({left:10,right:10})
.borderRadius(20)
}.alignItems(myCode==item.code?HorizontalAlign.End:HorizontalAlign.Start)
}
.width('100%').padding({right:10,left:10,top:20,bottom:20})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getListAll AST#parameter_list#Left ( AST#parameter#Left myCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left List AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left myCode AST#expression#Right == AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . RowReverse AST#member_expression#Right AST#expression#Right : AST#expression#Left FlexDirection AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Row AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . image AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left myCode AST#expression#Right !== AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left minWidth AST#property_name#Right : AST#expression#Left 100 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left minHeight AST#property_name#Right : AST#expression#Left 60 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left myCode AST#expression#Right == AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.wx_green' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.wx_white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left myCode AST#expression#Right == AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right : AST#expression#Left FlexAlign AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left myCode AST#expression#Right == AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right : AST#expression#Left HorizontalAlign AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder getListAll(myCode:string,item:List){
Flex({justifyContent:FlexAlign.Start,alignItems:ItemAlign.Center,direction:myCode==item.code?FlexDirection.RowReverse:FlexDirection.Row}){
Image(item.image).width(50).height(50).borderRadius(50).margin({right:10,left:10})
Column(){
if(myCode!==item.code){
Row(){
Text(item.name)
}
.justifyContent(FlexAlign.Start)
.padding({bottom:10})
}
Row(){
Text(item.content).fontSize(18).fontWeight(FontWeight.Bold)
}
.constraintSize({minWidth:100,minHeight:60})
.backgroundColor(myCode==item.code?$r('app.color.wx_green'):$r('app.color.wx_white'))
.justifyContent(myCode==item.code?FlexAlign.End:FlexAlign.Start)
.padding({left:10,right:10})
.borderRadius(20)
}.alignItems(myCode==item.code?HorizontalAlign.End:HorizontalAlign.Start)
}
.width('100%').padding({right:10,left:10,top:20,bottom:20})
}
|
https://github.com/Lateautumn00/HarmonyOS_WeChat.git/blob/88993b308d5018c11d4e6ddf7838a96c6384201c/entry/src/main/ets/pages/Chat.ets#L143-L167
|
5cc229f06afa22e63ec101730822ca3f3878a9db
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets
|
arkts
|
BaseNetWorkViewModel
|
@file 网络请求 ViewModel 基类
@description 提供通用的网络请求 ViewModel 基类,包含 UI 状态管理和请求执行逻辑。
@param T 网络请求数据项类型
@author Joker.X
|
@ObservedV2
export abstract class BaseNetWorkViewModel<T> extends BaseViewModel {
/**
* 通用网络请求 UI 状态
*/
@Trace
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
/**
* 请求成功后的数据
*/
@Trace
data: T | null = null;
/**
* 控制请求失败时是否显示 Toast 提示
*/
protected showErrorToast: boolean = false;
/**
* 子类必须实现此方法,返回网络请求 Promise
* @returns {Promise<NetworkResponse<T>>} 网络请求 Promise
*/
protected abstract requestRepository(): Promise<NetworkResponse<T>>;
/**
* 页面出现时的生命周期回调
* @returns {void} 无返回值
*/
aboutToAppear(): void {
this.executeRequest();
}
/**
* 发起请求
* @returns {void} 无返回值
*/
executeRequest(): void {
RequestHelper.repository<T>(this.requestRepository())
.toast(this.showErrorToast)
.start(() => this.onRequestStart())
.execute()
.then((data: T) => this.onRequestSuccess(data))
.catch(() => this.onRequestError());
}
/**
* 请求开始前回调
* @returns {void} 无返回值
*/
protected onRequestStart(): void {
this.setLoadingState();
}
/**
* 请求成功回调
* @param {T} data - 成功数据
* @returns {void} 无返回值
*/
protected onRequestSuccess(data: T): void {
this.data = data;
this.setSuccessState();
}
/**
* 请求失败回调
* @returns {void} 无返回值
*/
protected onRequestError(): void {
this.setErrorState();
}
/**
* 重试请求
* @returns {void} 无返回值
*/
retryRequest(): void {
this.setLoadingState();
this.executeRequest();
}
/**
* 设置加载中状态
* @returns {void} 无返回值
*/
protected setLoadingState(): void {
this.uiState = BaseNetWorkUiState.LOADING;
}
/**
* 设置成功状态
* @returns {void} 无返回值
*/
protected setSuccessState(): void {
this.uiState = BaseNetWorkUiState.SUCCESS;
}
/**
* 设置错误状态
* @returns {void} 无返回值
*/
protected setErrorState(): void {
this.uiState = BaseNetWorkUiState.ERROR;
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export abstract class BaseNetWorkViewModel AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 通用网络请求 UI 状态
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right uiState : AST#type_annotation#Left AST#primary_type#Left BaseNetWorkUiState AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 请求成功后的数据
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 控制请求失败时是否显示 Toast 提示
*/ AST#property_declaration#Left protected showErrorToast : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 子类必须实现此方法,返回网络请求 Promise
* @returns {Promise<NetworkResponse<T>>} 网络请求 Promise
*/ AST#method_declaration#Left protected abstract requestRepository AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /**
* 页面出现时的生命周期回调
* @returns {void} 无返回值
*/ AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . executeRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 发起请求
* @returns {void} 无返回值
*/ AST#method_declaration#Left executeRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . requestRepository AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showErrorToast AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRequestStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRequestSuccess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRequestError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 请求开始前回调
* @returns {void} 无返回值
*/ AST#method_declaration#Left protected onRequestStart AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setLoadingState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 请求成功回调
* @param {T} data - 成功数据
* @returns {void} 无返回值
*/ AST#method_declaration#Left protected onRequestSuccess AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setSuccessState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 请求失败回调
* @returns {void} 无返回值
*/ AST#method_declaration#Left protected onRequestError AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setErrorState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 重试请求
* @returns {void} 无返回值
*/ AST#method_declaration#Left retryRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setLoadingState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . executeRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 设置加载中状态
* @returns {void} 无返回值
*/ AST#method_declaration#Left protected setLoadingState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 设置成功状态
* @returns {void} 无返回值
*/ AST#method_declaration#Left protected setSuccessState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . SUCCESS AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 设置错误状态
* @returns {void} 无返回值
*/ AST#method_declaration#Left protected setErrorState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . ERROR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
|
@ObservedV2
export abstract class BaseNetWorkViewModel<T> extends BaseViewModel {
@Trace
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
@Trace
data: T | null = null;
protected showErrorToast: boolean = false;
protected abstract requestRepository(): Promise<NetworkResponse<T>>;
aboutToAppear(): void {
this.executeRequest();
}
executeRequest(): void {
RequestHelper.repository<T>(this.requestRepository())
.toast(this.showErrorToast)
.start(() => this.onRequestStart())
.execute()
.then((data: T) => this.onRequestSuccess(data))
.catch(() => this.onRequestError());
}
protected onRequestStart(): void {
this.setLoadingState();
}
protected onRequestSuccess(data: T): void {
this.data = data;
this.setSuccessState();
}
protected onRequestError(): void {
this.setErrorState();
}
retryRequest(): void {
this.setLoadingState();
this.executeRequest();
}
protected setLoadingState(): void {
this.uiState = BaseNetWorkUiState.LOADING;
}
protected setSuccessState(): void {
this.uiState = BaseNetWorkUiState.SUCCESS;
}
protected setErrorState(): void {
this.uiState = BaseNetWorkUiState.ERROR;
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L12-L114
|
b186cd90614c1dc15ef3589d4b56f16bbfbb8e20
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/main/src/main/ets/viewmodel/AboutViewModel.ets
|
arkts
|
@file 关于页面 ViewModel
@author Joker.X
|
@ObservedV2
export default class AboutViewModel extends BaseViewModel {
/**
* UIAbility 上下文
*/
private context: common.UIAbilityContext = ContextUtil.getUIAbilityCtx();
/**
* 关于页面链接列表
*/
readonly links: AboutLinkItem[] = [
{
title: $r("app.string.main_about_link_doc_title"),
url: $r("app.string.main_about_link_doc_url")
},
{
title: $r("app.string.main_about_link_github_title"),
url: $r("app.string.main_about_link_github_url")
},
{
title: $r("app.string.main_about_link_gitee_title"),
url: $r("app.string.main_about_link_gitee_url")
},
{
title: $r("app.string.main_about_link_demo_github_title"),
url: $r("app.string.main_about_link_demo_github_url")
},
{
title: $r("app.string.main_about_link_demo_gitee_title"),
url: $r("app.string.main_about_link_demo_gitee_url")
},
{
title: $r("app.string.main_about_link_ui_title"),
url: $r("app.string.main_about_link_ui_url")
},
{
title: $r("app.string.main_about_link_orm_title"),
url: $r("app.string.main_about_link_orm_url")
}
];
/**
* 打开链接
* @param {Resource} urlRes - 链接资源
* @returns {void} 无返回值
*/
openUrl(urlRes: Resource): void {
try {
const url: string = this.context.resourceManager.getStringSync(urlRes.id);
const want: Want = {
action: "ohos.want.action.viewData",
entities: ["entity.system.browsable"],
uri: url
};
this.context.startAbility(want).catch((error: Error) => {
console.error(`打开链接失败: ${JSON.stringify(error)}`);
});
} catch (error) {
console.error(`打开链接失败: ${JSON.stringify(error)}`);
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class AboutViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* UIAbility 上下文
*/ AST#property_declaration#Left private context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ContextUtil AST#expression#Right . getUIAbilityCtx AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 关于页面链接列表
*/ AST#property_declaration#Left readonly links : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AboutLinkItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_doc_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_doc_url" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_github_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_github_url" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_gitee_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_gitee_url" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_demo_github_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_demo_github_url" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_demo_gitee_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_demo_gitee_url" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_ui_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_ui_url" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_orm_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_about_link_orm_url" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 打开链接
* @param {Resource} urlRes - 链接资源
* @returns {void} 无返回值
*/ AST#method_declaration#Left openUrl AST#parameter_list#Left ( AST#parameter#Left urlRes : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left urlRes AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left "ohos.want.action.viewData" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left entities AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left "entity.system.browsable" AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left url AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . startAbility AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 打开链接失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 打开链接失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#decorated_export_declaration#Right
|
@ObservedV2
export default class AboutViewModel extends BaseViewModel {
private context: common.UIAbilityContext = ContextUtil.getUIAbilityCtx();
readonly links: AboutLinkItem[] = [
{
title: $r("app.string.main_about_link_doc_title"),
url: $r("app.string.main_about_link_doc_url")
},
{
title: $r("app.string.main_about_link_github_title"),
url: $r("app.string.main_about_link_github_url")
},
{
title: $r("app.string.main_about_link_gitee_title"),
url: $r("app.string.main_about_link_gitee_url")
},
{
title: $r("app.string.main_about_link_demo_github_title"),
url: $r("app.string.main_about_link_demo_github_url")
},
{
title: $r("app.string.main_about_link_demo_gitee_title"),
url: $r("app.string.main_about_link_demo_gitee_url")
},
{
title: $r("app.string.main_about_link_ui_title"),
url: $r("app.string.main_about_link_ui_url")
},
{
title: $r("app.string.main_about_link_orm_title"),
url: $r("app.string.main_about_link_orm_url")
}
];
openUrl(urlRes: Resource): void {
try {
const url: string = this.context.resourceManager.getStringSync(urlRes.id);
const want: Want = {
action: "ohos.want.action.viewData",
entities: ["entity.system.browsable"],
uri: url
};
this.context.startAbility(want).catch((error: Error) => {
console.error(`打开链接失败: ${JSON.stringify(error)}`);
});
} catch (error) {
console.error(`打开链接失败: ${JSON.stringify(error)}`);
}
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/AboutViewModel.ets#L11-L71
|
349d5bb5f940ad39a66f0889fdbd6c6ffca5e8dd
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets
|
arkts
|
getDlpPermission
|
获取沙箱权限
|
async getDlpPermission(): Promise<void> {
dlpPermission.getDLPPermissionInfo().then((data: dlpPermission.DLPPermissionInfo) => {
Logger.info(TAG, 'getDLPPermissionInfo, result: ' + JSON.stringify(data));
promptAction.showToast({ message: 'permission:' + decodeURIComponent(JSON.stringify(data)), duration: 2000 });
}).catch((err: BusinessError) => {
Logger.info(TAG, 'getDLPPermissionInfo: ' + JSON.stringify(err));
});
}
|
AST#method_declaration#Left async getDlpPermission AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dlpPermission AST#expression#Right . getDLPPermissionInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dlpPermission . DLPPermissionInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'getDLPPermissionInfo, result: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'permission:' AST#expression#Right + AST#expression#Left decodeURIComponent AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'getDLPPermissionInfo: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async getDlpPermission(): Promise<void> {
dlpPermission.getDLPPermissionInfo().then((data: dlpPermission.DLPPermissionInfo) => {
Logger.info(TAG, 'getDLPPermissionInfo, result: ' + JSON.stringify(data));
promptAction.showToast({ message: 'permission:' + decodeURIComponent(JSON.stringify(data)), duration: 2000 });
}).catch((err: BusinessError) => {
Logger.info(TAG, 'getDLPPermissionInfo: ' + JSON.stringify(err));
});
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets#L84-L91
|
fb7d151dd4c272bf72ef8f3349816cabc40a3a60
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/accessibility/AccessibilityService.ets
|
arkts
|
toggleVoiceOver
|
切换语音朗读
|
async toggleVoiceOver(enabled: boolean): Promise<void> {
await this.updateSettings({ voiceOverEnabled: enabled });
this.isVoiceOverActive = enabled;
if (enabled) {
await this.speak('语音朗读已开启');
}
}
|
AST#method_declaration#Left async toggleVoiceOver AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . updateSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left voiceOverEnabled AST#property_name#Right : AST#expression#Left enabled AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isVoiceOverActive AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left enabled AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . speak AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '语音朗读已开启' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async toggleVoiceOver(enabled: boolean): Promise<void> {
await this.updateSettings({ voiceOverEnabled: enabled });
this.isVoiceOverActive = enabled;
if (enabled) {
await this.speak('语音朗读已开启');
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L274-L281
|
f44ca022c62f12bd45dc89cccc4b83371dea3670
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/arkweb/ArkJsObject.ets
|
arkts
|
runJavaScriptFun
|
异步执行JavaScript方法
@param funName 方法名
@param param 方法参数
@returns
|
async runJavaScriptFun(funName: string, param?: string): Promise<string> {
if (this.controller) {
return ArkWebHelper.runJavaScriptFun(this.controller, funName, param);
}
return '';
}
|
AST#method_declaration#Left async runJavaScriptFun AST#parameter_list#Left ( AST#parameter#Left funName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . runJavaScriptFun AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right , AST#expression#Left funName AST#expression#Right , AST#expression#Left param AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async runJavaScriptFun(funName: string, param?: string): Promise<string> {
if (this.controller) {
return ArkWebHelper.runJavaScriptFun(this.controller, funName, param);
}
return '';
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L67-L72
|
ef2a01c5cf4eaaa922b2c9a6c131b106159cea8d
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ComponentEncapsulation/entry/src/main/ets/pages/EmitterCallPage.ets
|
arkts
|
ChildComponent
|
[Start emitter]
|
@Component
export struct ChildComponent {
public static readonly EVENT_ID_SWITCH_COLOR = 'SWITCH_COLOR';
@State bgColor: ResourceColor = Color.White;
private switchColor = () => {
if (this.bgColor === Color.White) {
this.bgColor = Color.Red;
} else {
this.bgColor = Color.White;
}
}
aboutToAppear(): void {
emitter.on(ChildComponent.EVENT_ID_SWITCH_COLOR, this.switchColor);
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChildComponent AST#component_body#Left { AST#property_declaration#Left public static readonly EVENT_ID_SWITCH_COLOR = AST#expression#Left 'SWITCH_COLOR' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private switchColor = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right === AST#expression#Left Color AST#expression#Right AST#binary_expression#Right AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left void AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left emitter AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ChildComponent AST#expression#Right . EVENT_ID_SWITCH_COLOR AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . switchColor AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct ChildComponent {
public static readonly EVENT_ID_SWITCH_COLOR = 'SWITCH_COLOR';
@State bgColor: ResourceColor = Color.White;
private switchColor = () => {
if (this.bgColor === Color.White) {
this.bgColor = Color.Red;
} else {
this.bgColor = Color.White;
}
}
aboutToAppear(): void {
emitter.on(ChildComponent.EVENT_ID_SWITCH_COLOR, this.switchColor);
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentEncapsulation/entry/src/main/ets/pages/EmitterCallPage.ets#L18-L32
|
d176d16264212c153b8215f247de6c4ae34feb09
|
gitee
|
Duke_Bit/logan
|
37ce340f90e508cbf3914162df2254aca76a525a
|
core/src/main/ets/Logan.ets
|
arkts
|
@brief 返回所有日志文件信息
|
export async function getAllFilesInfo(): Promise<Map<string, number>> {
let dir = LoganControlCenter.instance().dir
let allFilesInfo = new Map<string, number>()
if (!dir) {
return allFilesInfo
}
if (!dir.endsWith('/')) {
dir = dir + "/"
}
return fileIo.listFile(dir).then((files) => {
files.forEach(file => {
let info = fileIo.statSync(dir + file)
allFilesInfo.set(file, info.size)
})
return allFilesInfo
})
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left async function getAllFilesInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dir = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LoganControlCenter AST#expression#Right . instance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . dir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left allFilesInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left dir AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left allFilesInfo AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left dir AST#expression#Right AST#unary_expression#Right AST#expression#Right . endsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '/' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left dir = AST#expression#Left AST#binary_expression#Left AST#expression#Left dir AST#expression#Right + AST#expression#Left "/" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#ERROR#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . listFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dir AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left files AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left files AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left file => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left info = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left dir AST#expression#Right + AST#expression#Left file AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left allFilesInfo AST#ERROR#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left info AST#expression#Right . size AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left allFilesInfo AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#ERROR#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export async function getAllFilesInfo(): Promise<Map<string, number>> {
let dir = LoganControlCenter.instance().dir
let allFilesInfo = new Map<string, number>()
if (!dir) {
return allFilesInfo
}
if (!dir.endsWith('/')) {
dir = dir + "/"
}
return fileIo.listFile(dir).then((files) => {
files.forEach(file => {
let info = fileIo.statSync(dir + file)
allFilesInfo.set(file, info.size)
})
return allFilesInfo
})
}
}
|
https://github.com/Duke_Bit/logan/blob/37ce340f90e508cbf3914162df2254aca76a525a/core/src/main/ets/Logan.ets#L92-L109
|
18d441b0cca7616f40d582a851ef45b1ee10449e
|
gitee
|
|
wuyuanwuhui99/harmony-arkts-music-app-ui.git
|
fc75b993b76293666f9122f527ea3bc6caf7f75c
|
entry/src/main/ets/components/MusicMyComponent.ets
|
arkts
|
useMusicFavoriteList
|
@description: 跳转到歌单列表页
@date: 2024-07-16 22:37
@author wuwenqiang
|
useMusicFavoriteList(item:FavoriteDirectoryInterface){
router.pushUrl({
url: 'pages/MusicFavoriteListPage', // 目标url
params: {
favoriteDirectory: item
}
});
}
|
AST#method_declaration#Left useMusicFavoriteList AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left FavoriteDirectoryInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left 'pages/MusicFavoriteListPage' AST#expression#Right AST#property_assignment#Right , // 目标url AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left favoriteDirectory AST#property_name#Right : AST#expression#Left item AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
useMusicFavoriteList(item:FavoriteDirectoryInterface){
router.pushUrl({
url: 'pages/MusicFavoriteListPage',
params: {
favoriteDirectory: item
}
});
}
|
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/MusicMyComponent.ets#L49-L56
|
90f7989111242b6ff829999df43d4ff750cd11b9
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets
|
arkts
|
RGB颜色类型
|
export interface ColorRgb {
// 红色(Red)
red: number;
// 绿色(Green)
green: number;
// 蓝色(Blue)
blue: number;
// 透明度
alpha: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ColorRgb AST#object_type#Left { // 红色(Red) AST#type_member#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 绿色(Green) AST#type_member#Left green : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 蓝色(Blue) AST#type_member#Left blue : 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 alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ColorRgb {
red: number;
green: number;
blue: number;
alpha: number;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets#L19-L31
|
acaf09e1568339b7da0a59a7ae13748543afd1f9
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
同步提供商枚举
|
export enum SyncProvider {
ICLOUD = 'icloud',
GOOGLE = 'google',
MICROSOFT = 'microsoft',
CUSTOM = 'custom'
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum SyncProvider AST#enum_body#Left { AST#enum_member#Left ICLOUD = AST#expression#Left 'icloud' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left GOOGLE = AST#expression#Left 'google' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MICROSOFT = AST#expression#Left 'microsoft' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CUSTOM = AST#expression#Left 'custom' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum SyncProvider {
ICLOUD = 'icloud',
GOOGLE = 'google',
MICROSOFT = 'microsoft',
CUSTOM = 'custom'
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L440-L445
|
acadcddd24cb8305a0e92821a4503d48e77dacd3
|
github
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_tabs.ets
|
arkts
|
goForward_onWorkingTab
|
Try to go forward on current main tab.
@returns true if success.
@returns false if failed, perhaps there is no way forward.
|
goForward_onWorkingTab() {
if (this.Tabs[this.main_tab_idx].controller?.accessForward()) {
this.Tabs[this.main_tab_idx].controller?.forward();
}
}
|
AST#method_declaration#Left goForward_onWorkingTab 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Tabs AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . main_tab_idx AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ?. accessForward AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Tabs AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . main_tab_idx AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ?. forward AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
goForward_onWorkingTab() {
if (this.Tabs[this.main_tab_idx].controller?.accessForward()) {
this.Tabs[this.main_tab_idx].controller?.forward();
}
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L103-L107
|
bc2544c7b65ccd099379e88f5def3d84c7838651
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/blendmode/src/main/ets/model/DataSource.ets
|
arkts
|
getData
|
获取当前下标的数据
@param index 下标
@returns 当前下标所对应的数据
|
getData(index: number): PendantType {
return this.pendantData[index];
}
|
AST#method_declaration#Left getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PendantType AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pendantData AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getData(index: number): PendantType {
return this.pendantData[index];
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/blendmode/src/main/ets/model/DataSource.ets#L93-L95
|
12610214d509f019022e2f696e0ef2307fdd0adc
|
gitee
|
fengcreate/harmony-document
|
798534b0f76399dc84e7940f5b14b3ae4e53c6a9
|
BackupRestore/entry/src/main/ets/restore/sp/SpTransferManager.ets
|
arkts
|
moveSpFile
|
Move HarmonyOS 4.0 XML file to HarmonyOS NEXT.
@param context context.
@return success return true, failed return false.
|
private moveSpFile(context: common.Context): boolean {
try {
let sourceSpPath = '/data/storage/el2/backup/restore/com.example.backuprestore/ce/shared_prefs';
if (!fileIo.accessSync(sourceSpPath)) {
hilog.error(0x0000, 'BackupRestore SpTransferManager', `moveSpFile, ${sourceSpPath} can't access`);
return false;
}
let listFileNames: string[] = fileIo.listFileSync(sourceSpPath);
if (!listFileNames || listFileNames.length === 0) {
hilog.error(0x0000, 'BackupRestore SpTransferManager', `moveSpFile, ${sourceSpPath} is not file`);
return false;
}
let targetPath: string = context.preferencesDir;
listFileNames.forEach((fileName: string) => {
let srcPath = `${sourceSpPath}/${fileName}`;
let destPath = `${targetPath}/${fileName}`;
if (fileIo.statSync(srcPath).isFile()) {
fileIo.moveFileSync(srcPath, destPath);
} else {
fileIo.moveDirSync(srcPath, targetPath);
}
});
return true;
} catch (error) {
hilog.error(0x0000, 'BackupRestore SpTransferManager', `moveSpFile, error: ${JSON.stringify(error)}`);
return false;
}
}
|
AST#method_declaration#Left private moveSpFile AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sourceSpPath = AST#expression#Left '/data/storage/el2/backup/restore/com.example.backuprestore/ce/shared_prefs' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left fileIo AST#expression#Right AST#unary_expression#Right AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourceSpPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'BackupRestore SpTransferManager' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` moveSpFile, AST#template_substitution#Left $ { AST#expression#Left sourceSpPath AST#expression#Right } AST#template_substitution#Right can't access ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left listFileNames : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . listFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourceSpPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left listFileNames AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left listFileNames AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'BackupRestore SpTransferManager' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` moveSpFile, AST#template_substitution#Left $ { AST#expression#Left sourceSpPath AST#expression#Right } AST#template_substitution#Right is not file ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left targetPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . preferencesDir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listFileNames AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left srcPath = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left sourceSpPath AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left fileName AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left destPath = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left targetPath AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left fileName AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . isFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . moveFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcPath AST#expression#Right , AST#expression#Left destPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . moveDirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcPath AST#expression#Right , AST#expression#Left targetPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'BackupRestore SpTransferManager' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` moveSpFile, error: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private moveSpFile(context: common.Context): boolean {
try {
let sourceSpPath = '/data/storage/el2/backup/restore/com.example.backuprestore/ce/shared_prefs';
if (!fileIo.accessSync(sourceSpPath)) {
hilog.error(0x0000, 'BackupRestore SpTransferManager', `moveSpFile, ${sourceSpPath} can't access`);
return false;
}
let listFileNames: string[] = fileIo.listFileSync(sourceSpPath);
if (!listFileNames || listFileNames.length === 0) {
hilog.error(0x0000, 'BackupRestore SpTransferManager', `moveSpFile, ${sourceSpPath} is not file`);
return false;
}
let targetPath: string = context.preferencesDir;
listFileNames.forEach((fileName: string) => {
let srcPath = `${sourceSpPath}/${fileName}`;
let destPath = `${targetPath}/${fileName}`;
if (fileIo.statSync(srcPath).isFile()) {
fileIo.moveFileSync(srcPath, destPath);
} else {
fileIo.moveDirSync(srcPath, targetPath);
}
});
return true;
} catch (error) {
hilog.error(0x0000, 'BackupRestore SpTransferManager', `moveSpFile, error: ${JSON.stringify(error)}`);
return false;
}
}
|
https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/sp/SpTransferManager.ets#L81-L109
|
7ddcfcbb223f658348b39af83cf9148714eb9a9a
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets
|
arkts
|
tabBuilderTwo
|
[StartExclude switch_the_tab_to_a_specific_tab]
|
@Builder
tabBuilderTwo(title: ResourceStr, targetIndex: number) {
Column() {
Text(title)
.fontColor(this.currentIndexTwo === targetIndex ? '#F111C1' : '#6B6B6B')
}
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilderTwo AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left title AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndexTwo AST#member_expression#Right AST#expression#Right === AST#expression#Left targetIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#F111C1' AST#expression#Right : AST#expression#Left '#6B6B6B' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
tabBuilderTwo(title: ResourceStr, targetIndex: number) {
Column() {
Text(title)
.fontColor(this.currentIndexTwo === targetIndex ? '#F111C1' : '#6B6B6B')
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets#L40-L46
|
52b9e3c6d8c5b6161def78291ce00385130b971a
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/handletabs/Index.ets
|
arkts
|
HandleTabsComponent
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export {HandleTabsComponent} from './src/main/ets/pages/HandleTabs';
|
AST#export_declaration#Left export { HandleTabsComponent } from './src/main/ets/pages/HandleTabs' ; AST#export_declaration#Right
|
export {HandleTabsComponent} from './src/main/ets/pages/HandleTabs';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/Index.ets#L15-L15
|
e606ae32464f7da02d714fb06499303ee823f651
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets
|
arkts
|
VideoPlayer
|
video controller component
|
@Component
export struct VideoPlayer {
private source: string | Resource = '';
private controller: VideoController = new VideoController();
private previewUris: Resource = $r('app.media.ic_preview');
@Provide currentTime: number = 0;
@Provide durationTime: number = 0;
@Provide durationStringTime: string = START_TIME;
@Provide currentStringTime: string = START_TIME;
@Consume isPlay: boolean;
@Consume isOpacity: boolean;
@Consume flag: boolean;
@Consume isLoading: boolean;
@Consume progressVal: number;
build() {
Column() {
Video({
src: this.source,
previewUri: this.previewUris,
controller: this.controller
})
.width(ALL_PERCENT)
.height(STRING_PERCENT.NINETY_PERCENT)
.controls(false)
.autoPlay(false)
.objectFit(ImageFit.Contain)
.loop(false)
.onUpdate((event) => {
if (event) {
this.currentTime = event.time;
this.currentStringTime = changeSliderTime(this.currentTime);
}
})
.onPrepared((event) => {
this.prepared(event?.duration);
})
.onFinish(() => {
this.finish();
})
.onError(() => {
prompt.showToast({
duration: COMMON_NUM_DURATION,
message: MESSAGE
});
})
VideoSlider({ controller: this.controller })
}
}
/**
* video component prepared callback
*/
prepared(duration: number) {
this.durationTime = duration;
let second: number = duration % COMMON_NUM_MINUTE;
let min: number = Number.parseInt((duration / COMMON_NUM_MINUTE).toString());
let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min;
let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : second;
this.durationStringTime = `${head}${SPLIT}${end}`;
this.flag = true;
}
/**
* video component finish callback
*/
finish() {
this.isPlay = false;
this.isOpacity = false;
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoPlayer AST#component_body#Left { AST#property_declaration#Left private source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left VideoController AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left VideoController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private previewUris : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_preview' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right currentTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right durationTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right durationStringTime : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left START_TIME AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right currentStringTime : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left START_TIME AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isPlay : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isOpacity : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right flag : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isLoading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right progressVal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Video ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . source AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left previewUri : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . previewUris AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left ALL_PERCENT AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left STRING_PERCENT AST#expression#Right . NINETY_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . controls ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . autoPlay ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . loop ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onUpdate ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left event AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . time AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentStringTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left changeSliderTime AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onPrepared ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . prepared AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right ?. duration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onFinish ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . finish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onError ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left COMMON_NUM_DURATION AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left MESSAGE AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left VideoSlider ( AST#component_parameters#Left { AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right /**
* video component prepared callback
*/ AST#method_declaration#Left prepared AST#parameter_list#Left ( AST#parameter#Left duration : 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . durationTime AST#member_expression#Right = AST#expression#Left duration AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left second : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left duration AST#expression#Right % AST#expression#Left COMMON_NUM_MINUTE AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left duration AST#expression#Right / AST#expression#Left COMMON_NUM_MINUTE AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left head = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right < AST#expression#Left COMMON_NUM_DOUBLE AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left ZERO_STR AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left min AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right : AST#expression#Left min AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left end = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left second AST#expression#Right < AST#expression#Left COMMON_NUM_DOUBLE AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left ZERO_STR AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left second AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right : AST#expression#Left second AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . durationStringTime AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left head AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left SPLIT AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left end AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flag AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* video component finish callback
*/ AST#method_declaration#Left finish 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 . isPlay AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct VideoPlayer {
private source: string | Resource = '';
private controller: VideoController = new VideoController();
private previewUris: Resource = $r('app.media.ic_preview');
@Provide currentTime: number = 0;
@Provide durationTime: number = 0;
@Provide durationStringTime: string = START_TIME;
@Provide currentStringTime: string = START_TIME;
@Consume isPlay: boolean;
@Consume isOpacity: boolean;
@Consume flag: boolean;
@Consume isLoading: boolean;
@Consume progressVal: number;
build() {
Column() {
Video({
src: this.source,
previewUri: this.previewUris,
controller: this.controller
})
.width(ALL_PERCENT)
.height(STRING_PERCENT.NINETY_PERCENT)
.controls(false)
.autoPlay(false)
.objectFit(ImageFit.Contain)
.loop(false)
.onUpdate((event) => {
if (event) {
this.currentTime = event.time;
this.currentStringTime = changeSliderTime(this.currentTime);
}
})
.onPrepared((event) => {
this.prepared(event?.duration);
})
.onFinish(() => {
this.finish();
})
.onError(() => {
prompt.showToast({
duration: COMMON_NUM_DURATION,
message: MESSAGE
});
})
VideoSlider({ controller: this.controller })
}
}
prepared(duration: number) {
this.durationTime = duration;
let second: number = duration % COMMON_NUM_MINUTE;
let min: number = Number.parseInt((duration / COMMON_NUM_MINUTE).toString());
let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min;
let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : second;
this.durationStringTime = `${head}${SPLIT}${end}`;
this.flag = true;
}
finish() {
this.isPlay = false;
this.isOpacity = false;
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets#L34-L104
|
503e213942f659782696e6dd860ed3dc4a7e0e52
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.atomicservice.InterstitialDialogAction.d.ets
|
arkts
|
Defines the properties required by the dialog.
@interface DialogOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12
|
export declare interface DialogOptions {
/**
* The UIContext required by the dialog.
*
* @type { UIContext }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
uiContext: UIContext;
/**
* The type of the bottom offset.
*
* @type { ?BottomOffset }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
bottomOffsetType?: BottomOffset
/**
* The title of the dialog.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
title?: ResourceStr;
/**
* The subtitle of the dialog.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
subtitle?: ResourceStr;
/**
* The color of the title.
*
* @type { ?(ResourceStr | Color) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
titleColor?: ResourceStr | Color;
/**
* The color of the subtitle.
*
* @type { ?(ResourceStr | Color) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
subtitleColor?: ResourceStr | Color;
/**
* The background of the dialog.
*
* @type { ?Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
backgroundImage?: Resource;
/**
* The foreground of the dialog.
*
* @type { ?Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
foregroundImage?: Resource;
/**
* The style of the close button.
*
* @type { ?IconStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
iconStyle?: IconStyle;
/**
* The relative position of the title and subtitle.
*
* @type { ?TitlePosition }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
titlePosition?: TitlePosition;
/**
* The action after clicking dialog.
*
* @type { ?Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
onDialogClick?: Callback<void>;
/**
* The action after clicking close button.
*
* @type { ?Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
onDialogClose?: Callback<void>;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface DialogOptions AST#object_type#Left { /**
* The UIContext required by the dialog.
*
* @type { UIContext }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The type of the bottom offset.
*
* @type { ?BottomOffset }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left bottomOffsetType ? : AST#type_annotation#Left AST#primary_type#Left BottomOffset AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* The title of the dialog.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left title ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The subtitle of the dialog.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left subtitle ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The color of the title.
*
* @type { ?(ResourceStr | Color) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left titleColor ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left Color AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The color of the subtitle.
*
* @type { ?(ResourceStr | Color) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left subtitleColor ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left Color AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The background of the dialog.
*
* @type { ?Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left backgroundImage ? : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The foreground of the dialog.
*
* @type { ?Resource }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left foregroundImage ? : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The style of the close button.
*
* @type { ?IconStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left iconStyle ? : AST#type_annotation#Left AST#primary_type#Left IconStyle AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The relative position of the title and subtitle.
*
* @type { ?TitlePosition }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left titlePosition ? : AST#type_annotation#Left AST#primary_type#Left TitlePosition AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The action after clicking dialog.
*
* @type { ?Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left onDialogClick ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* The action after clicking close button.
*
* @type { ?Callback<void> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left onDialogClose ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export declare interface DialogOptions {
uiContext: UIContext;
bottomOffsetType?: BottomOffset
title?: ResourceStr;
subtitle?: ResourceStr;
titleColor?: ResourceStr | Color;
subtitleColor?: ResourceStr | Color;
backgroundImage?: Resource;
foregroundImage?: Resource;
iconStyle?: IconStyle;
titlePosition?: TitlePosition;
onDialogClick?: Callback<void>;
onDialogClose?: Callback<void>;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.InterstitialDialogAction.d.ets#L108-L217
|
7f214bb19f7730a090d4c5031b32088d4c85b5b5
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/fileFs/FileFs.ets
|
arkts
|
分享应用文件
|
export async function shareFile(fileName: string): Promise<void> {
// 获取文件的沙箱路径
let pathInSandbox = context.filesDir + '/' + fileName + '.txt';
// 将沙箱路径转换为uri
let uri = fileUri.getUriFromPath(pathInSandbox);
// [End get_uri]
Logger.info('FilePath is : ' + uri);
let want: Want = {
// 配置被分享文件的读写权限,例如对被分享应用进行读写授权
flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
// 配置分享应用的隐式拉起规则
action: 'ohos.want.action.sendData',
uri: uri,
type: 'text/plain',
};
await context.startAbility(want)
.then(() => {
Logger.info('Invoke getCurrentBundleStats succeeded.');
})
.catch((err: BusinessError) => {
Logger.error(`Invoke startAbility failed, code is ${err.code}, message is ${err.message}`);
});
}
|
AST#export_declaration#Left export AST#function_declaration#Left async function shareFile AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 获取文件的沙箱路径 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pathInSandbox = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left fileName AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '.txt' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 将沙箱路径转换为uri AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uri = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pathInSandbox AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // [End get_uri] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'FilePath is : ' AST#expression#Right + AST#expression#Left uri AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { // 配置被分享文件的读写权限,例如对被分享应用进行读写授权 AST#property_assignment#Left AST#property_name#Left flags AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantConstant AST#expression#Right . Flags AST#member_expression#Right AST#expression#Right . FLAG_AUTH_WRITE_URI_PERMISSION AST#member_expression#Right AST#expression#Right | AST#expression#Left wantConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . Flags AST#member_expression#Right AST#expression#Right . FLAG_AUTH_READ_URI_PERMISSION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 配置分享应用的隐式拉起规则 AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'ohos.want.action.sendData' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left uri AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left 'text/plain' AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left context AST#expression#Right AST#await_expression#Right AST#expression#Right . startAbility AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Invoke getCurrentBundleStats succeeded.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Invoke startAbility failed, code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export async function shareFile(fileName: string): Promise<void> {
let pathInSandbox = context.filesDir + '/' + fileName + '.txt';
let uri = fileUri.getUriFromPath(pathInSandbox);
Logger.info('FilePath is : ' + uri);
let want: Want = {
flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
action: 'ohos.want.action.sendData',
uri: uri,
type: 'text/plain',
};
await context.startAbility(want)
.then(() => {
Logger.info('Invoke getCurrentBundleStats succeeded.');
})
.catch((err: BusinessError) => {
Logger.error(`Invoke startAbility failed, code is ${err.code}, message is ${err.message}`);
});
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/fileFs/FileFs.ets#L31-L53
|
16efd10bd698bc521678f223144c2566b8c16e73
|
gitee
|
|
hqj201013136012/HarmonyMiliUiPro.git
|
0625e681e07b771998a0ac4430824627d0eb60ed
|
entry/src/main/ets/itemview/ItemSetCommonView.ets
|
arkts
|
ItemSetCommonView
|
通用的设置ItemView
|
@ComponentV2
export struct ItemSetCommonView {
@Require @Param itemData: SetItemData
build() {
Column() {
if (this.itemData.itemType == SetItemType.SwitchItem) {
RelativeContainer() {
Column() {
Text(this.itemData.name)
.fontColor('#ffffff')
.fontSize(28)
Text(this.itemData.discribeStr)
.fontColor('#808080')
.fontSize(22)
.margin({ top: 4 })
}
.margin({ left: 56 })
.height('100%')
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
Toggle({ type: ToggleType.Switch, isOn: this.itemData.swichStatus })
.size({ width: 96, height: 52 })
.selectedColor('#2495ff')
.switchPointColor('#FFFFFF')
.onChange((isOn: boolean) => {
console.info('Component status:' + isOn)
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "__container__", align: HorizontalAlign.End },
})
.margin({ right: 58 })
}
.backgroundColor('#1A1A1A')
.borderRadius({
topLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
topRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
bottomLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
bottomRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
})
.height(100)
} else if (this.itemData.itemType == SetItemType.ArrowItem) {
RelativeContainer() {
Text(this.itemData.name)
.fontColor('#ffffff')
.fontSize(28)
.margin({ left: 56 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
Image($r('app.media.icon_next'))
.width(36)
.height(36)
.margin({ right: 56 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "__container__", align: HorizontalAlign.End },
})
.id('right_next_img')
Text(this.itemData.rightText)
.fontColor('#ffffff')
.fontSize(28)
.margin({ right: 8 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "right_next_img", align: HorizontalAlign.Start },
})
}
.backgroundColor('#1A1A1A')
.borderRadius({
topLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
topRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
bottomLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
bottomRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
})
.height(100)
} else if (this.itemData.itemType == SetItemType.ProcessItem) {
RelativeContainer() {
Text(this.itemData.name)
.fontColor('#ffffff')
.fontSize(28)
.margin({ left: 56 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
Row() {
Slider({
value: this.itemData.processValue,
style: SliderStyle.OutSet,
direction: Axis.Horizontal,
})
.trackThickness(16)
.blockSize({ width: 30, height: 30 })
.width(550)
.blockColor('#ffffff')
.trackColor('#262626')
.selectedColor('#2495ff')
.onChange((value: number, mode: SliderChangeMode) => {
this.itemData.processValue = value
})
.id('slider_view')
Text(this.itemData.processValue+'%')
.fontColor('#ffffff')
.fontSize(28)
.margin({left:24,right:56})
}
.justifyContent(FlexAlign.Center)
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
right: { anchor: "__container__", align: HorizontalAlign.End },
})
}
.backgroundColor('#1A1A1A')
.borderRadius({
topLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
topRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
bottomLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
bottomRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
})
.height(100)
} else if (this.itemData.itemType == SetItemType.TitleText) {
Column() {
Text(this.itemData.name)
.padding({ left: 45, top: 28, bottom: 15 })
.fontColor('#ffffff')
.fontSize(30)
.width('100%')
}
}
if (this.itemData.isShowDiv) {
Column() {
Divider().height(1).color('#262626').margin({ left: 48, right: 48 })
}
.backgroundColor('#1A1A1A')
}
}
.padding({ bottom: this.itemData.isPaddingBot ? 24 : 0 })
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ItemSetCommonView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right itemData : AST#type_annotation#Left AST#primary_type#Left SetItemData AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . itemType AST#member_expression#Right AST#expression#Right == AST#expression#Left SetItemType AST#expression#Right AST#binary_expression#Right AST#expression#Right . SwitchItem AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . discribeStr AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#808080' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 56 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Toggle ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Switch AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . swichStatus AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 96 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 52 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left '#2495ff' AST#expression#Right ) AST#modifier_chain_expression#Left . switchPointColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isOn : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Component status:' AST#expression#Right + AST#expression#Left isOn AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 58 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#1A1A1A' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TopRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TopRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . BottomRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . BottomRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . itemType AST#member_expression#Right AST#expression#Right == AST#expression#Left SetItemType AST#expression#Right AST#binary_expression#Right AST#expression#Right . ArrowItem AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 56 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon_next' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 36 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 36 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 56 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'right_next_img' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . rightText AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "right_next_img" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#1A1A1A' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TopRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TopRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . BottomRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . BottomRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . itemType AST#member_expression#Right AST#expression#Right == AST#expression#Left SetItemType AST#expression#Right AST#binary_expression#Right AST#expression#Right . ProcessItem AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 56 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Slider ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . processValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left style : AST#expression#Left AST#member_expression#Left AST#expression#Left SliderStyle AST#expression#Right . OutSet AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . trackThickness ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . blockSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 550 AST#expression#Right ) AST#modifier_chain_expression#Left . blockColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . trackColor ( AST#expression#Left '#262626' AST#expression#Right ) AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left '#2495ff' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left SliderChangeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . processValue AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'slider_view' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . processValue AST#member_expression#Right AST#expression#Right + AST#expression#Left '%' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 56 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left center AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#1A1A1A' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TopRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TopRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . BottomRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . AllRad AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . radType AST#member_expression#Right AST#expression#Right == AST#expression#Left RadiusType AST#expression#Right AST#binary_expression#Right AST#expression#Right . BottomRad AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left 12 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . itemType AST#member_expression#Right AST#expression#Right == AST#expression#Left SetItemType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TitleText AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 45 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 28 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . isShowDiv AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#262626' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 48 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 48 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#1A1A1A' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . isPaddingBot AST#member_expression#Right AST#expression#Right ? AST#expression#Left 24 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct ItemSetCommonView {
@Require @Param itemData: SetItemData
build() {
Column() {
if (this.itemData.itemType == SetItemType.SwitchItem) {
RelativeContainer() {
Column() {
Text(this.itemData.name)
.fontColor('#ffffff')
.fontSize(28)
Text(this.itemData.discribeStr)
.fontColor('#808080')
.fontSize(22)
.margin({ top: 4 })
}
.margin({ left: 56 })
.height('100%')
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
Toggle({ type: ToggleType.Switch, isOn: this.itemData.swichStatus })
.size({ width: 96, height: 52 })
.selectedColor('#2495ff')
.switchPointColor('#FFFFFF')
.onChange((isOn: boolean) => {
console.info('Component status:' + isOn)
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "__container__", align: HorizontalAlign.End },
})
.margin({ right: 58 })
}
.backgroundColor('#1A1A1A')
.borderRadius({
topLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
topRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
bottomLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
bottomRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
})
.height(100)
} else if (this.itemData.itemType == SetItemType.ArrowItem) {
RelativeContainer() {
Text(this.itemData.name)
.fontColor('#ffffff')
.fontSize(28)
.margin({ left: 56 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
Image($r('app.media.icon_next'))
.width(36)
.height(36)
.margin({ right: 56 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "__container__", align: HorizontalAlign.End },
})
.id('right_next_img')
Text(this.itemData.rightText)
.fontColor('#ffffff')
.fontSize(28)
.margin({ right: 8 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "right_next_img", align: HorizontalAlign.Start },
})
}
.backgroundColor('#1A1A1A')
.borderRadius({
topLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
topRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
bottomLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
bottomRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
})
.height(100)
} else if (this.itemData.itemType == SetItemType.ProcessItem) {
RelativeContainer() {
Text(this.itemData.name)
.fontColor('#ffffff')
.fontSize(28)
.margin({ left: 56 })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
Row() {
Slider({
value: this.itemData.processValue,
style: SliderStyle.OutSet,
direction: Axis.Horizontal,
})
.trackThickness(16)
.blockSize({ width: 30, height: 30 })
.width(550)
.blockColor('#ffffff')
.trackColor('#262626')
.selectedColor('#2495ff')
.onChange((value: number, mode: SliderChangeMode) => {
this.itemData.processValue = value
})
.id('slider_view')
Text(this.itemData.processValue+'%')
.fontColor('#ffffff')
.fontSize(28)
.margin({left:24,right:56})
}
.justifyContent(FlexAlign.Center)
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
right: { anchor: "__container__", align: HorizontalAlign.End },
})
}
.backgroundColor('#1A1A1A')
.borderRadius({
topLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
topRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.TopRad) ? 12 : 0,
bottomLeft: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
bottomRight: (this.itemData.radType == RadiusType.AllRad || this.itemData.radType == RadiusType.BottomRad) ?
12 : 0,
})
.height(100)
} else if (this.itemData.itemType == SetItemType.TitleText) {
Column() {
Text(this.itemData.name)
.padding({ left: 45, top: 28, bottom: 15 })
.fontColor('#ffffff')
.fontSize(30)
.width('100%')
}
}
if (this.itemData.isShowDiv) {
Column() {
Divider().height(1).color('#262626').margin({ left: 48, right: 48 })
}
.backgroundColor('#1A1A1A')
}
}
.padding({ bottom: this.itemData.isPaddingBot ? 24 : 0 })
}
}
|
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/itemview/ItemSetCommonView.ets#L6-L163
|
27cdc50b72ea30fc2a2ce79d11da489505a4dae6
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
|
arkts
|
updateTableName
|
修改表名
@param oldTableName 旧表名
@param newTableName 新表名
|
async updateTableName(oldTableName: string, newTableName: string): Promise<void> {
if (store === undefined) {
return;
}
const updateTableSql: string = util.format(Constants.UPDATE_TABLE_SQL_TEMPLATE, oldTableName, newTableName);
try {
await store.executeSql(updateTableSql);
} catch (err) {
logger.error(`updateTableName failed,code is ${err.code}, message is ${err.message}, the sql is ${updateTableSql}`);
}
}
|
AST#method_declaration#Left async updateTableName AST#parameter_list#Left ( AST#parameter#Left oldTableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newTableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left store AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left updateTableSql : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . format AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . UPDATE_TABLE_SQL_TEMPLATE AST#member_expression#Right AST#expression#Right , AST#expression#Left oldTableName AST#expression#Right , AST#expression#Left newTableName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left store AST#expression#Right AST#await_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateTableSql AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` updateTableName failed,code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , the sql is AST#template_substitution#Left $ { AST#expression#Left updateTableSql AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async updateTableName(oldTableName: string, newTableName: string): Promise<void> {
if (store === undefined) {
return;
}
const updateTableSql: string = util.format(Constants.UPDATE_TABLE_SQL_TEMPLATE, oldTableName, newTableName);
try {
await store.executeSql(updateTableSql);
} catch (err) {
logger.error(`updateTableName failed,code is ${err.code}, message is ${err.message}, the sql is ${updateTableSql}`);
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L96-L106
|
ef83182677a608cda8ff69f1703ad30d242eb3ff
|
gitee
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
entry/src/main/ets/dialog/DialogStyle.ets
|
arkts
|
自定义预设样式
|
export enum DialogPresetStyle {
/**
* 确认按钮样式
* 黑底、白字
*/
confirmBtn = 'confirmBtnStyle',
/**
* 确认按钮 黄色渐变样式
*/
confirmYellowLinearGradient1Btn = 'confirmYellowLinearGradient1Btn',
/**
* 确认按钮 黄色渐变样式2
*/
confirmYellowLinearGradient2Btn = 'confirmYellowLinearGradient2Btn',
/**
* 通用标题样式
* 纯文本标题,居中等
*/
commonHeader = 'commonHeaderStyle',
/**
* 自定义样式的 弹窗内顶部关闭 挂件样式
*/
insideTopRightYellowCloseAttach = 'insideTopRightYellowCloseAttach',
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum DialogPresetStyle AST#enum_body#Left { /**
* 确认按钮样式
* 黑底、白字
*/ AST#enum_member#Left confirmBtn = AST#expression#Left 'confirmBtnStyle' AST#expression#Right AST#enum_member#Right , /**
* 确认按钮 黄色渐变样式
*/ AST#enum_member#Left confirmYellowLinearGradient1Btn = AST#expression#Left 'confirmYellowLinearGradient1Btn' AST#expression#Right AST#enum_member#Right , /**
* 确认按钮 黄色渐变样式2
*/ AST#enum_member#Left confirmYellowLinearGradient2Btn = AST#expression#Left 'confirmYellowLinearGradient2Btn' AST#expression#Right AST#enum_member#Right , /**
* 通用标题样式
* 纯文本标题,居中等
*/ AST#enum_member#Left commonHeader = AST#expression#Left 'commonHeaderStyle' AST#expression#Right AST#enum_member#Right , /**
* 自定义样式的 弹窗内顶部关闭 挂件样式
*/ AST#enum_member#Left insideTopRightYellowCloseAttach = AST#expression#Left 'insideTopRightYellowCloseAttach' AST#expression#Right AST#enum_member#Right , } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum DialogPresetStyle {
confirmBtn = 'confirmBtnStyle',
confirmYellowLinearGradient1Btn = 'confirmYellowLinearGradient1Btn',
confirmYellowLinearGradient2Btn = 'confirmYellowLinearGradient2Btn',
commonHeader = 'commonHeaderStyle',
insideTopRightYellowCloseAttach = 'insideTopRightYellowCloseAttach',
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/entry/src/main/ets/dialog/DialogStyle.ets#L7-L31
|
5b45cf96cea23ad4188e6094cbd3b510ba056e61
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets
|
arkts
|
getById
|
MARK: - 查询操作
|
async getById(idxx: number): Promise<CDBSound | null> {
if (!this.db) return null;
const sql = `SELECT * FROM ${Tables.CSound.name}
WHERE ${Tables.CSound.Col.idxx} = ?`;
return await this.db.getData(sql, [idxx], rs => this.createCSoundFromRs(rs));
}
|
AST#method_declaration#Left async getById AST#parameter_list#Left ( AST#parameter#Left idxx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CDBSound AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sql = AST#expression#Left AST#template_literal#Left ` SELECT * FROM AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . CSound AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
WHERE AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . CSound AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . idxx AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right = ? ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left idxx AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left rs => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createCSoundFromRs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getById(idxx: number): Promise<CDBSound | null> {
if (!this.db) return null;
const sql = `SELECT * FROM ${Tables.CSound.name}
WHERE ${Tables.CSound.Col.idxx} = ?`;
return await this.db.getData(sql, [idxx], rs => this.createCSoundFromRs(rs));
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L86-L93
|
024a5524d5406346c2c5cbdcfc5a9ea1a19d6947
|
github
|
openharmony/applications_settings
|
aac607310ec30e30d1d54db2e04d055655f72730
|
common/component/src/main/ets/default/imageAnimatorComponent.ets
|
arkts
|
ImageAnimatorComponent
|
ImageAnimator component
|
@Component
export default struct ImageAnimatorComponent {
private imageWidth: number | Resource = 0
private imageHeight: number | Resource = 0
private whtl: number | string = ComponentConfig.value_20;
build() {
Column() {
ImageAnimator()
.images([
{
src: 'res/image/xxxhdpi/ic_loading01.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/xxxhdpi/ic_loading02.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/xxxhdpi/ic_loading03.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/xxxhdpi/ic_loading04.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/xxxhdpi/ic_loading05.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/hdpi/ic_loading06.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
}])
.width(this.imageWidth)
.height(this.imageHeight)
.iterations(-1)
.fixedSize(true)
.reverse(true)
.fillMode(FillMode.None)
.state(AnimationStatus.Running)
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct ImageAnimatorComponent AST#component_body#Left { AST#property_declaration#Left private imageWidth : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private imageHeight : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private whtl : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . value_20 AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ImageAnimator ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . images ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left src AST#property_name#Right : AST#expression#Left 'res/image/xxxhdpi/ic_loading01.png' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . DURATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left src AST#property_name#Right : AST#expression#Left 'res/image/xxxhdpi/ic_loading02.png' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . DURATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left src AST#property_name#Right : AST#expression#Left 'res/image/xxxhdpi/ic_loading03.png' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . DURATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left src AST#property_name#Right : AST#expression#Left 'res/image/xxxhdpi/ic_loading04.png' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . DURATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left src AST#property_name#Right : AST#expression#Left 'res/image/xxxhdpi/ic_loading05.png' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . DURATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left src AST#property_name#Right : AST#expression#Left 'res/image/hdpi/ic_loading06.png' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . DURATION_TIME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . whtl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . iterations ( AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fixedSize ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . reverse ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fillMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left FillMode AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . state ( AST#expression#Left AST#member_expression#Left AST#expression#Left AnimationStatus AST#expression#Right . Running AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export default struct ImageAnimatorComponent {
private imageWidth: number | Resource = 0
private imageHeight: number | Resource = 0
private whtl: number | string = ComponentConfig.value_20;
build() {
Column() {
ImageAnimator()
.images([
{
src: 'res/image/xxxhdpi/ic_loading01.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/xxxhdpi/ic_loading02.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/xxxhdpi/ic_loading03.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/xxxhdpi/ic_loading04.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/xxxhdpi/ic_loading05.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
},
{
src: 'res/image/hdpi/ic_loading06.png',
duration: ComponentConfig.DURATION_TIME,
width: this.whtl,
height: this.whtl,
top: this.whtl,
left: this.whtl
}])
.width(this.imageWidth)
.height(this.imageHeight)
.iterations(-1)
.fixedSize(true)
.reverse(true)
.fillMode(FillMode.None)
.state(AnimationStatus.Running)
}
}
}
|
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/imageAnimatorComponent.ets#L20-L87
|
096555b464aab3c75402ba1fd7ffafd0886a70c6
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets
|
arkts
|
fillGlobalStateDialog
|
填充全局状态保留能力弹窗的布局以及内容
@param wrapBuilder 布局
@param params 内容
|
fillGlobalStateDialog(wrapBuilder: WrappedBuilder<[ESObject]>, params: ESObject) {
this.wrapBuilder = wrapBuilder;
this.params = params;
this.refreshNode();
}
|
AST#method_declaration#Left fillGlobalStateDialog AST#parameter_list#Left ( AST#parameter#Left wrapBuilder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 . wrapBuilder AST#member_expression#Right = AST#expression#Left wrapBuilder AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . params AST#member_expression#Right = AST#expression#Left params AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refreshNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
fillGlobalStateDialog(wrapBuilder: WrappedBuilder<[ESObject]>, params: ESObject) {
this.wrapBuilder = wrapBuilder;
this.params = params;
this.refreshNode();
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets#L78-L82
|
4f48d8f820f1e7bfb2fdf37cb98aab05d0044687
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/util/EmitterUtil.ets
|
arkts
|
subscribe
|
订阅Emitter消息
@param msgType 消息类型
@param callback 消息接收回调
@returns 订阅ID(用于取消订阅)
|
public static subscribe(msgType: string, callback: (data: EmitterMsgData) => void): void {
if (!msgType || !callback) {
console.error('EmitterUtil: 订阅参数不能为空');
}
// 创建订阅事件
emitter.on(msgType, (eventData: emitter.EventData) => {
try {
const msgData = eventData.data as EmitterMsgData;
callback(msgData);
} catch (error) {
console.error(`EmitterUtil: 解析消息失败,错误:${JSON.stringify(error)}`);
}
});
console.log(`EmitterUtil: 成功订阅消息,类型:${msgType}`);
}
|
AST#method_declaration#Left public static subscribe AST#parameter_list#Left ( AST#parameter#Left msgType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left EmitterMsgData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left msgType AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left callback AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'EmitterUtil: 订阅参数不能为空' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 创建订阅事件 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left emitter AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left msgType AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left eventData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left emitter . EventData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left msgData = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eventData AST#expression#Right . data AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left EmitterMsgData AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left msgData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` EmitterUtil: 解析消息失败,错误: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` EmitterUtil: 成功订阅消息,类型: AST#template_substitution#Left $ { AST#expression#Left msgType AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static subscribe(msgType: string, callback: (data: EmitterMsgData) => void): void {
if (!msgType || !callback) {
console.error('EmitterUtil: 订阅参数不能为空');
}
emitter.on(msgType, (eventData: emitter.EventData) => {
try {
const msgData = eventData.data as EmitterMsgData;
callback(msgData);
} catch (error) {
console.error(`EmitterUtil: 解析消息失败,错误:${JSON.stringify(error)}`);
}
});
console.log(`EmitterUtil: 成功订阅消息,类型:${msgType}`);
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/EmitterUtil.ets#L24-L39
|
75458e4a3b1c2b64c3cdbd561c325d95006958ee
|
gitee
|
ashcha0/line-inspection-terminal-frontend_arkts.git
|
c82616097e8a3b257b7b01e75b6b83ce428b518c
|
entry/src/main/ets/services/ConfigService.ets
|
arkts
|
配置验证结果接口
|
export interface ValidationResult {
valid: boolean;
errors: string[];
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ValidationResult AST#object_type#Left { AST#type_member#Left valid : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left errors : 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#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ValidationResult {
valid: boolean;
errors: string[];
}
|
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/ConfigService.ets#L47-L50
|
4d699a2760d09533a087150407e3dab9f0de5a7c
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/styledtext/src/main/ets/model/TextModel.ets
|
arkts
|
跳转的链接地址
|
constructor(id: number | string, type: MyCustomSpanType = MyCustomSpanType.Normal, content: string, url?: string) {
this.id = id;
this.type = type;
this.content = content;
if (url) {
this.url = url;
}
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left MyCustomSpanType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left MyCustomSpanType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left url ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . type AST#member_expression#Right = AST#expression#Left type AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left url AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . url AST#member_expression#Right = AST#expression#Left url AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor(id: number | string, type: MyCustomSpanType = MyCustomSpanType.Normal, content: string, url?: string) {
this.id = id;
this.type = type;
this.content = content;
if (url) {
this.url = url;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/model/TextModel.ets#L48-L55
|
90c56835e59b21e196331796423487d9f7ba001d
|
gitee
|
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets
|
arkts
|
verifySegmentSync
|
对数据进行分段验签,同步
@param data 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、、等)。
@param len 自定义的数据拆分长度。
@returns
|
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
verifier.updateSync(updateDataBlob); //分段update
}
//已通过分段传入所有明文,故此处verify第一个参数传入null
let res = verifier.verifySync(null, signDataBlob);
return res;
}
|
AST#method_declaration#Left static verifySegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left verifier = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createVerify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left len AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left len AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateData AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //分段update } AST#block_statement#Right AST#for_statement#Right AST#statement#Right //已通过分段传入所有明文,故此处verify第一个参数传入null AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left verifier AST#expression#Right . verifySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left res AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData = data.subarray(i, i + len);
let updateDataBlob: cryptoFramework.DataBlob = { data: updateData };
verifier.updateSync(updateDataBlob);
}
let res = verifier.verifySync(null, signDataBlob);
return res;
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets#L420-L432
|
d119c4cc549f1ac2d059f921d3a66c994843ce67
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_speech/src/main/ets/Helper.ets
|
arkts
|
getFileName
|
通过URI或路径,获取文件名。
@param uriOrPath URI或路径
@returns
|
static getFileName(uriOrPath: string): string {
return Helper.getFileUri(uriOrPath).name;
}
|
AST#method_declaration#Left static getFileName AST#parameter_list#Left ( AST#parameter#Left uriOrPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . getFileUri AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uriOrPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getFileName(uriOrPath: string): string {
return Helper.getFileUri(uriOrPath).name;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L259-L261
|
aed297022f2aeafb50e3210c6bc46493a0d9dfa9
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
|
arkts
|
add
|
/ 向db中添加新的wordIds
|
async add(wordIds: number[]): Promise<void> {
await PlanManager.add(wordIds, this);
}
|
AST#method_declaration#Left async add AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PlanManager AST#expression#Right AST#await_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wordIds AST#expression#Right , AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async add(wordIds: number[]): Promise<void> {
await PlanManager.add(wordIds, this);
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L484-L486
|
5f0ddab66d97b553bbf0396775e9be5c243ef571
|
github
|
Vinson0709/arkdemo.git
|
793491fe04b387f55dadfef86b30e28d0535d994
|
entry/src/main/ets/pages/Texts.ets
|
arkts
|
bodyBuilder
|
内容展示(自定义builder渲染)
|
@Builder bodyBuilder() {
Column(){
// Text 文本
Text('Text 文本')
.fontSize(14)
.margin({ top:20, bottom: 12})
Text('我是一个文本')
.textStyle()
.fontSize(12)
.textAlign(TextAlign.Start)
Text('我是绿色,向中间对其')
.textStyle()
.fontSize(14)
.textAlign(TextAlign.Center)
.fontColor(Color.Green)
Text('我是蓝色,向右对其')
.textStyle()
.fontSize(16)
.textAlign(TextAlign.End)
.fontColor(Color.Blue)
Text('我太长了,我太长了,我太长了,我太长了')
.textStyle()
.fontSize(14)
.textOverflow({overflow: TextOverflow.Ellipsis})
.maxLines(1)
// 分割线
Divider()
.color('#CCCCCC')
.dividerStyle()
// TextInput 文本输入
Text('TextInput 文本输入')
.fontSize(14)
.margin({ bottom: 12})
TextInput({
placeholder: '单行输入', // 无文本时显示的内容
})
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 }) // placeholder字体设置
.margin({ bottom: 10 })
TextArea({ placeholder: '多行输入' })
.fontSize(14)
.placeholderFont({ size: 14 }) // placeholder字体设置
.width(260)
.height(80)
// 分割线
Divider()
.color('#CCCCCC')
.dividerStyle()
// TextInput 类型
Text('TextInput 类型')
.fontSize(14)
.margin({ bottom: 12})
TextInput({ placeholder: '普通类型' })
.type(InputType.Normal)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 }) // placeholder字体设置
.margin({ bottom: 10 })
TextInput({ placeholder: '密码类型' })
.type(InputType.Password)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 }) // placeholder字体设置
.margin({ bottom: 10 })
TextInput({ placeholder: '数字类型' })
.type(InputType.Number)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 }) // placeholder字体设置
.margin({ bottom: 10 })
TextInput({ placeholder: '电话号码' })
.type(InputType.PhoneNumber)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 }) // placeholder字体设置
.margin({ bottom: 10 })
TextInput({ placeholder: '电子邮件' })
.type(InputType.Email)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 }) // placeholder字体设置
.margin({ bottom: 10 })
// 分割线
Divider()
.color('#CCCCCC')
.dividerStyle()
// Search 搜索
Text('Search 搜索')
.fontSize(14)
.margin({ bottom: 12})
Search({
placeholder: '输入搜索内容...'
})
.inputStyle()
.textFont({ size: 14 }) // 文本字体设置
.placeholderFont({ size: 14 }) // placeholder字体设置
.searchButton('搜索')
}
.pageStyle() //自定义样式:page
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // Text 文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Text 文本' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '我是一个文本' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '我是绿色,向中间对其' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '我是蓝色,向右对其' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '我太长了,我太长了,我太长了,我太长了' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 分割线 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left '#CCCCCC' AST#expression#Right ) AST#modifier_chain_expression#Left . dividerStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // TextInput 文本输入 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'TextInput 文本输入' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '单行输入' AST#expression#Right AST#component_parameter#Right , // 无文本时显示的内容 } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . inputStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // placeholder字体设置 AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextArea ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '多行输入' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // placeholder字体设置 AST#modifier_chain_expression#Left . width ( AST#expression#Left 260 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 分割线 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left '#CCCCCC' AST#expression#Right ) AST#modifier_chain_expression#Left . dividerStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // TextInput 类型 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'TextInput 类型' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '普通类型' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . inputStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // placeholder字体设置 AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '密码类型' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . Password AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . inputStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // placeholder字体设置 AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '数字类型' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . Number AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . inputStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // placeholder字体设置 AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '电话号码' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . PhoneNumber AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . inputStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // placeholder字体设置 AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '电子邮件' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . Email AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . inputStyle ( ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // placeholder字体设置 AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 分割线 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left '#CCCCCC' AST#expression#Right ) AST#modifier_chain_expression#Left . dividerStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // Search 搜索 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Search 搜索' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Search ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '输入搜索内容...' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . inputStyle ( ) AST#modifier_chain_expression#Left . textFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // 文本字体设置 AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left 14 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // placeholder字体设置 AST#modifier_chain_expression#Left . searchButton ( AST#expression#Left '搜索' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . pageStyle ( ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //自定义样式:page } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder bodyBuilder() {
Column(){
Text('Text 文本')
.fontSize(14)
.margin({ top:20, bottom: 12})
Text('我是一个文本')
.textStyle()
.fontSize(12)
.textAlign(TextAlign.Start)
Text('我是绿色,向中间对其')
.textStyle()
.fontSize(14)
.textAlign(TextAlign.Center)
.fontColor(Color.Green)
Text('我是蓝色,向右对其')
.textStyle()
.fontSize(16)
.textAlign(TextAlign.End)
.fontColor(Color.Blue)
Text('我太长了,我太长了,我太长了,我太长了')
.textStyle()
.fontSize(14)
.textOverflow({overflow: TextOverflow.Ellipsis})
.maxLines(1)
Divider()
.color('#CCCCCC')
.dividerStyle()
Text('TextInput 文本输入')
.fontSize(14)
.margin({ bottom: 12})
TextInput({
placeholder: '单行输入',
})
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 })
.margin({ bottom: 10 })
TextArea({ placeholder: '多行输入' })
.fontSize(14)
.placeholderFont({ size: 14 })
.width(260)
.height(80)
Divider()
.color('#CCCCCC')
.dividerStyle()
Text('TextInput 类型')
.fontSize(14)
.margin({ bottom: 12})
TextInput({ placeholder: '普通类型' })
.type(InputType.Normal)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 })
.margin({ bottom: 10 })
TextInput({ placeholder: '密码类型' })
.type(InputType.Password)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 })
.margin({ bottom: 10 })
TextInput({ placeholder: '数字类型' })
.type(InputType.Number)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 })
.margin({ bottom: 10 })
TextInput({ placeholder: '电话号码' })
.type(InputType.PhoneNumber)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 })
.margin({ bottom: 10 })
TextInput({ placeholder: '电子邮件' })
.type(InputType.Email)
.inputStyle()
.fontSize(14)
.placeholderFont({ size: 14 })
.margin({ bottom: 10 })
Divider()
.color('#CCCCCC')
.dividerStyle()
Text('Search 搜索')
.fontSize(14)
.margin({ bottom: 12})
Search({
placeholder: '输入搜索内容...'
})
.inputStyle()
.textFont({ size: 14 })
.placeholderFont({ size: 14 })
.searchButton('搜索')
}
.pageStyle()
}
|
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Texts.ets#L61-L167
|
60997ecff164d9ad73530a355a50ee864c5d527e
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/SliderExample/entry/src/main/ets/common/Constants.ets
|
arkts
|
The mode display the different styles of Slider.
|
export enum SliderMode {
SPEED = 1,
SCALE = 2,
};
|
AST#export_declaration#Left export AST#enum_declaration#Left enum SliderMode AST#enum_body#Left { AST#enum_member#Left SPEED = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SCALE = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right , } AST#enum_body#Right AST#enum_declaration#Right ; AST#export_declaration#Right
|
export enum SliderMode {
SPEED = 1,
SCALE = 2,
};
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SliderExample/entry/src/main/ets/common/Constants.ets#L46-L49
|
5cbc7cef1be111d6656ccef0b5e6393a7e4b9da2
|
gitee
|
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/an0n-chat-lib/0.1.5/package/build/token.ets
|
arkts
|
应用约束18:构造函数参数需要在类中声明字段
|
constructor(service: string, type: TokenType, value: string) {
this.service = service;
this.type = type;
this.value = value;
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left service : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TokenType 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_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . service AST#member_expression#Right = AST#expression#Left service AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . type AST#member_expression#Right = AST#expression#Left type AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . value AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor(service: string, type: TokenType, value: string) {
this.service = service;
this.type = type;
this.value = value;
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/token.ets#L15-L19
|
0476b1b152ddf03635ea573cf01b916aa0e35f65
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customstepper/src/main/ets/view/HeaderView.ets
|
arkts
|
HeaderView
|
展示页面上方的返回/更多按钮(页面公共部分)及对应页面的Title
|
@Component
export struct HeaderView {
titleArray: string[] = []; // 承载每个页面的title,由父组件传值
@Link currentIndex: number; // 当前页面的索引,由索引及titleArray确定当前页面的Title
build() {
Column() {
Row() {
Image($r("sys.media.ohos_ic_compnent_titlebar_back"))
.height($r("app.integer.stepper_header_image_height"))
.aspectRatio(1)
.onClick(() => {
notImplementPrompt();
})
Text(this.titleArray[this.currentIndex])
.fontWeight(FontWeight.Bold)
.fontSize($r("app.integer.stepper_title_font_size"))
.textAlign(TextAlign.Center)
Image($r("sys.media.ohos_ic_public_more"))
.height($r("app.integer.stepper_header_image_height"))
.aspectRatio(1)
.onClick(() => {
notImplementPrompt();
})
}
.width('100%')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
Divider()
.strokeWidth(1)
.backgroundColor($r("app.color.stepper_divider_color"))
}
.width('100%')
.height($r("app.integer.stepper_header_image_height"))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HeaderView AST#component_body#Left { AST#property_declaration#Left titleArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 承载每个页面的title,由父组件传值 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 当前页面的索引,由索引及titleArray确定当前页面的Title AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "sys.media.ohos_ic_compnent_titlebar_back" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.stepper_header_image_height" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left notImplementPrompt AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . titleArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.stepper_title_font_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "sys.media.ohos_ic_public_more" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.stepper_header_image_height" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left notImplementPrompt AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.stepper_divider_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.stepper_header_image_height" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct HeaderView {
titleArray: string[] = [];
@Link currentIndex: number;
build() {
Column() {
Row() {
Image($r("sys.media.ohos_ic_compnent_titlebar_back"))
.height($r("app.integer.stepper_header_image_height"))
.aspectRatio(1)
.onClick(() => {
notImplementPrompt();
})
Text(this.titleArray[this.currentIndex])
.fontWeight(FontWeight.Bold)
.fontSize($r("app.integer.stepper_title_font_size"))
.textAlign(TextAlign.Center)
Image($r("sys.media.ohos_ic_public_more"))
.height($r("app.integer.stepper_header_image_height"))
.aspectRatio(1)
.onClick(() => {
notImplementPrompt();
})
}
.width('100%')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
Divider()
.strokeWidth(1)
.backgroundColor($r("app.color.stepper_divider_color"))
}
.width('100%')
.height($r("app.integer.stepper_header_image_height"))
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customstepper/src/main/ets/view/HeaderView.ets#L22-L60
|
c681498d9fb498eaa6aa96d9e495ba50fe32e8fb
|
gitee
|
fmtjava/Ohs_ArkTs_Eyepetizer.git
|
79578f394ccb926da1455e63b7fe0722df9b9a22
|
entry/src/main/ets/common/Immersive.ets
|
arkts
|
设置导航栏透明
|
export function hideNavBar(ctx: common.Context | undefined): void {
// 1. 获取当前窗口
window.getLastWindow(ctx, (err: BusinessError, win: window.Window) => {
if (err.code) {
console.error(`获取窗口失败:${err.message}`);
return;
}
// 2. 设置导航区域隐藏
win.setSpecificSystemBarEnabled('navigationIndicator', false).then(() => {
console.info('Succeeded in setting the navigation indicator to be invisible.');
}).catch((err: BusinessError) => {
console.error(`Failed to set the navigation indicator to be invisible. Code is ${err.code}, message is ${err.message}`);
});
});
}
|
AST#export_declaration#Left export AST#function_declaration#Left function hideNavBar AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 1. 获取当前窗口 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ctx AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left win : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取窗口失败: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 2. 设置导航区域隐藏 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left win AST#expression#Right . setSpecificSystemBarEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'navigationIndicator' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Succeeded in setting the navigation indicator to be invisible.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to set the navigation indicator to be invisible. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function hideNavBar(ctx: common.Context | undefined): void {
window.getLastWindow(ctx, (err: BusinessError, win: window.Window) => {
if (err.code) {
console.error(`获取窗口失败:${err.message}`);
return;
}
win.setSpecificSystemBarEnabled('navigationIndicator', false).then(() => {
console.info('Succeeded in setting the navigation indicator to be invisible.');
}).catch((err: BusinessError) => {
console.error(`Failed to set the navigation indicator to be invisible. Code is ${err.code}, message is ${err.message}`);
});
});
}
|
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/Immersive.ets#L6-L20
|
565f67027dc2781df5c61f29910dcf346289ff88
|
github
|
|
kaina404/HarmonyStock.git
|
99233a46fb0dfb21e02294c730fd80e2fb404f9b
|
entry/src/main/ets/bean/FiveDayMinuteData.ets
|
arkts
|
五日的莫一天的所有数据的集合
|
export class FiveDayMinuteDataWrapper {
date: Date//五日的年月日
fiveDayMinuteDataAry: FiveDayItemMinuteData[]
maxPrice: number //该天的所有价格的最大值(fiveDayMinuteDataAry的价格最大值)
minPrice: number //该天的所有价格的最小值(fiveDayMinuteDataAry的价格最小值)
openPrice: number //该天的第一个价格(fiveDayMinuteDataAry的第一分钟的价格)
}
|
AST#export_declaration#Left export AST#class_declaration#Left class FiveDayMinuteDataWrapper AST#class_body#Left { AST#ERROR#Left date AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right //五日的年月日 AST#ERROR#Left fiveDayM in uteDataAry : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FiveDayItemMinuteData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Left maxPrice : number //该天的所有价格的最大值(fiveDayMinuteDataAry的价格最大值) m in Price AST#ERROR#Right : number //该天的所有价格的最小值(fiveDayMinuteDataAry的价格最小值) openPrice : number AST#ERROR#Right //该天的第一个价格(fiveDayMinuteDataAry的第一分钟的价格) } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class FiveDayMinuteDataWrapper {
date: Date
fiveDayMinuteDataAry: FiveDayItemMinuteData[]
maxPrice: number
minPrice: number
openPrice: number
}
|
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/bean/FiveDayMinuteData.ets#L32-L38
|
618f13769f89a586ca587a56933f90ea7a95d666
|
github
|
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
libs/core/src/main/ets/utils/DateUtils.ets
|
arkts
|
getTodayStr
|
获取今天的时间,字符串类型
@param format 格式化字符串,(yyyy-MM-dd HH:mm:ss)
@returns
|
static getTodayStr(format?: string): string {
return DateUtils.getFormatDateStr(new Date(), format)
}
|
AST#method_declaration#Left static getTodayStr AST#parameter_list#Left ( AST#parameter#Left format ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . getFormatDateStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left format AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getTodayStr(format?: string): string {
return DateUtils.getFormatDateStr(new Date(), format)
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L113-L115
|
f2dca8d725f795182f7c4102e0026b0d5a05835e
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets
|
arkts
|
TabSheets
|
隐藏关闭按钮时页签数量
|
@Component
export struct TabSheets {
@Link tabArray: Array<number>; // 控制页签渲染的数组
@Link @Watch('onFocusIndexChange') focusIndex: number; // Tabs组件当前显示的页签下标
controller: TabsController = new TabsController(); // Tabs控制器
@State middleIndex: number = this.focusIndex; // 中间变量
private toastDuration: number = 2000; // toast弹窗时长
/**
* 更新中间变量
*/
onFocusIndexChange() {
this.middleIndex = this.focusIndex;
}
build() {
Row({ space: STYLE_CONFIGURATION.TAB_BAR_ITEM_GUTTER }) {
// 性能知识点:此处为横向列表,列表项确定且数量较少,使用了ForEach,在列表项多的情况下,推荐使用LazyForeEach
ForEach(this.tabArray, (item: number, index: number) => {
Row({ space: STYLE_CONFIGURATION.TAB_BAR_CONTENT_GUTTER }) {
Image($r('app.media.handle_tabs_ic_public_worldclock_filled'))
.width(STYLE_CONFIGURATION.ICON_SIZE)
.aspectRatio(1)
Text($r('app.string.handletabs_handle_tabs_new_sheet'))
.textOverflow({ overflow: TextOverflow.Clip })
.maxLines(1)
.flexShrink(1)
/**
* 场景1:页签数量小于HIDE_CLOSE_SHEET_COUNT时,所有页签都显示关闭图标。
* 场景2:页签数量大于HIDE_CLOSE_SHEET_COUNT时,只有获焦页签显示关闭图标。
*/
Stack() {
if (this.tabArray.length < HIDE_CLOSE_SHEET_COUNT || this.middleIndex === index) {
Image($r('app.media.handle_tabs_ic_public_cancel_filled'))
.id('tabs_cancel')
.width(STYLE_CONFIGURATION.BIG_ICON_SIZE)
.aspectRatio(1)
.padding(STYLE_CONFIGURATION.BIG_ICON_PADDING)
.margin(this.tabArray.length === MAX_SHEET_COUNT ? { right: STYLE_CONFIGURATION.IMAGE_MARGIN } : 0)
.onClick(() => {
// 关闭页签
if (this.tabArray.length > 1) {
this.tabArray.splice(index, 1);
if (this.tabArray[index] === undefined) {
this.focusIndex = index - 1;
} else if (this.tabArray[index] !== undefined && this.focusIndex !== index) {
this.focusIndex -= 1;
}
}
})
}
}
}
.flexShrink(1)
.padding({
left: $r('sys.float.ohos_id_elements_margin_horizontal_m'),
right: $r('sys.float.ohos_id_elements_margin_horizontal_m')
})
.borderRadius($r('sys.float.ohos_id_corner_radius_default_xs'))
.height('100%')
.backgroundColor(this.middleIndex === index ? $r('sys.color.ohos_id_color_background') :
$r('sys.color.ohos_id_color_sub_background'))
.onClick(() => {
this.controller.changeIndex(index);
this.focusIndex = index;
})
// 性能知识点:if条件变更时,会导致if嵌套子组件所在的父组件接节点刷新,使用Stack容器可以减少刷新范围
Stack() {
if (this.middleIndex !== index && this.middleIndex - 1 !== index) {
Divider()
.vertical(true)
.strokeWidth(STYLE_CONFIGURATION.SEPARATOR_STROKE_WIDTH)
.height('50%')
.lineCap(LineCapStyle.Round)
}
}
})
Image($r('app.media.handle_tabs_ic_public_add_filled'))
.id('tabs_filled')
.width(STYLE_CONFIGURATION.BIG_ICON_SIZE)
.aspectRatio(1)
.padding(STYLE_CONFIGURATION.BIG_ICON_PADDING)
.onClick(() => {
// 新增页签
if (this.tabArray.length < MAX_SHEET_COUNT) {
this.tabArray.push(this.tabArray.length);
const newTabIndex: number = this.tabArray.length - 1;
this.middleIndex = newTabIndex;
animateTo({ duration: 200 }, () => {
this.focusIndex = newTabIndex;
})
} else {
promptAction.showToast({
message: $r("app.string.handletabs_handle_toast"),
duration: this.toastDuration
});
}
})
}
.padding(STYLE_CONFIGURATION.TAB_SHEET_PADDING)
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
.width('100%')
.height(STYLE_CONFIGURATION.TAB_BAR_HEIGHT)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TabSheets AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right tabArray : 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 控制页签渲染的数组 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'onFocusIndexChange' AST#expression#Right ) AST#decorator#Right focusIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // Tabs组件当前显示的页签下标 AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left TabsController AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TabsController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // Tabs控制器 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right middleIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusIndex AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 中间变量 AST#property_declaration#Left private toastDuration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2000 AST#expression#Right ; AST#property_declaration#Right // toast弹窗时长 /**
* 更新中间变量
*/ AST#method_declaration#Left onFocusIndexChange 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 . middleIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusIndex AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . TAB_BAR_ITEM_GUTTER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 性能知识点:此处为横向列表,列表项确定且数量较少,使用了ForEach,在列表项多的情况下,推荐使用LazyForeEach AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . TAB_BAR_CONTENT_GUTTER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.handle_tabs_ic_public_worldclock_filled' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . ICON_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.handletabs_handle_tabs_new_sheet' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Clip AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . flexShrink ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right /**
* 场景1:页签数量小于HIDE_CLOSE_SHEET_COUNT时,所有页签都显示关闭图标。
* 场景2:页签数量大于HIDE_CLOSE_SHEET_COUNT时,只有获焦页签显示关闭图标。
*/ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left HIDE_CLOSE_SHEET_COUNT AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . middleIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.handle_tabs_ic_public_cancel_filled' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'tabs_cancel' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . BIG_ICON_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . BIG_ICON_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left MAX_SHEET_COUNT AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . IMAGE_MARGIN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 关闭页签 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusIndex AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . focusIndex AST#member_expression#Right AST#expression#Right !== AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusIndex AST#member_expression#Right -= AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . flexShrink ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_elements_margin_horizontal_m' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_elements_margin_horizontal_m' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_corner_radius_default_xs' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . middleIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_sub_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 性能知识点:if条件变更时,会导致if嵌套子组件所在的父组件接节点刷新,使用Stack容器可以减少刷新范围 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . middleIndex AST#member_expression#Right AST#expression#Right !== AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . middleIndex AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right !== AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . vertical ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . SEPARATOR_STROKE_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '50%' AST#expression#Right ) AST#modifier_chain_expression#Left . lineCap ( AST#expression#Left AST#member_expression#Left AST#expression#Left LineCapStyle AST#expression#Right . Round AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.handle_tabs_ic_public_add_filled' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'tabs_filled' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . BIG_ICON_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . BIG_ICON_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 新增页签 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left MAX_SHEET_COUNT AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newTabIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . middleIndex AST#member_expression#Right = AST#expression#Left newTabIndex AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 200 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . focusIndex AST#member_expression#Right = AST#expression#Left newTabIndex AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.handletabs_handle_toast" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toastDuration AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . TAB_SHEET_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_sub_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left STYLE_CONFIGURATION AST#expression#Right . TAB_BAR_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct TabSheets {
@Link tabArray: Array<number>;
@Link @Watch('onFocusIndexChange') focusIndex: number;
controller: TabsController = new TabsController();
@State middleIndex: number = this.focusIndex;
private toastDuration: number = 2000;
onFocusIndexChange() {
this.middleIndex = this.focusIndex;
}
build() {
Row({ space: STYLE_CONFIGURATION.TAB_BAR_ITEM_GUTTER }) {
ForEach(this.tabArray, (item: number, index: number) => {
Row({ space: STYLE_CONFIGURATION.TAB_BAR_CONTENT_GUTTER }) {
Image($r('app.media.handle_tabs_ic_public_worldclock_filled'))
.width(STYLE_CONFIGURATION.ICON_SIZE)
.aspectRatio(1)
Text($r('app.string.handletabs_handle_tabs_new_sheet'))
.textOverflow({ overflow: TextOverflow.Clip })
.maxLines(1)
.flexShrink(1)
Stack() {
if (this.tabArray.length < HIDE_CLOSE_SHEET_COUNT || this.middleIndex === index) {
Image($r('app.media.handle_tabs_ic_public_cancel_filled'))
.id('tabs_cancel')
.width(STYLE_CONFIGURATION.BIG_ICON_SIZE)
.aspectRatio(1)
.padding(STYLE_CONFIGURATION.BIG_ICON_PADDING)
.margin(this.tabArray.length === MAX_SHEET_COUNT ? { right: STYLE_CONFIGURATION.IMAGE_MARGIN } : 0)
.onClick(() => {
if (this.tabArray.length > 1) {
this.tabArray.splice(index, 1);
if (this.tabArray[index] === undefined) {
this.focusIndex = index - 1;
} else if (this.tabArray[index] !== undefined && this.focusIndex !== index) {
this.focusIndex -= 1;
}
}
})
}
}
}
.flexShrink(1)
.padding({
left: $r('sys.float.ohos_id_elements_margin_horizontal_m'),
right: $r('sys.float.ohos_id_elements_margin_horizontal_m')
})
.borderRadius($r('sys.float.ohos_id_corner_radius_default_xs'))
.height('100%')
.backgroundColor(this.middleIndex === index ? $r('sys.color.ohos_id_color_background') :
$r('sys.color.ohos_id_color_sub_background'))
.onClick(() => {
this.controller.changeIndex(index);
this.focusIndex = index;
})
Stack() {
if (this.middleIndex !== index && this.middleIndex - 1 !== index) {
Divider()
.vertical(true)
.strokeWidth(STYLE_CONFIGURATION.SEPARATOR_STROKE_WIDTH)
.height('50%')
.lineCap(LineCapStyle.Round)
}
}
})
Image($r('app.media.handle_tabs_ic_public_add_filled'))
.id('tabs_filled')
.width(STYLE_CONFIGURATION.BIG_ICON_SIZE)
.aspectRatio(1)
.padding(STYLE_CONFIGURATION.BIG_ICON_PADDING)
.onClick(() => {
if (this.tabArray.length < MAX_SHEET_COUNT) {
this.tabArray.push(this.tabArray.length);
const newTabIndex: number = this.tabArray.length - 1;
this.middleIndex = newTabIndex;
animateTo({ duration: 200 }, () => {
this.focusIndex = newTabIndex;
})
} else {
promptAction.showToast({
message: $r("app.string.handletabs_handle_toast"),
duration: this.toastDuration
});
}
})
}
.padding(STYLE_CONFIGURATION.TAB_SHEET_PADDING)
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
.width('100%')
.height(STYLE_CONFIGURATION.TAB_BAR_HEIGHT)
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets#L22-L128
|
19a0d6a8eed2705c8c9f61b628044e9985a07e99
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/viewmodel/CartViewModel.ets
|
arkts
|
toggleSpecSelected
|
切换规格选中状态
@param {number} goodsId 商品ID
@param {number} specId 规格ID
@returns {void} 无返回值
|
toggleSpecSelected(goodsId: number, specId: number): void {
const key = `${goodsId}_${specId}`;
const newSet = new Set(this.selectedSpecIds);
if (newSet.has(key)) {
newSet.delete(key);
} else {
newSet.add(key);
}
this.selectedSpecIds = newSet;
}
|
AST#method_declaration#Left toggleSpecSelected AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left goodsId AST#expression#Right } AST#template_substitution#Right _ AST#template_substitution#Left $ { AST#expression#Left specId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedSpecIds AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSet AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSet AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newSet AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedSpecIds AST#member_expression#Right = AST#expression#Left newSet AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
toggleSpecSelected(goodsId: number, specId: number): void {
const key = `${goodsId}_${specId}`;
const newSet = new Set(this.selectedSpecIds);
if (newSet.has(key)) {
newSet.delete(key);
} else {
newSet.add(key);
}
this.selectedSpecIds = newSet;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L113-L122
|
251a43f7e3696d0e559adaf1e39e357aa1986bd6
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/ReviewUtils.ets
|
arkts
|
getCurrentBundleName
|
获取当前应用的包名
@returns 当前应用的包名
|
static getCurrentBundleName(): string {
const bundleInfo = bundleManager.getBundleInfoForSelfSync(0);
return bundleInfo.name;
}
|
AST#method_declaration#Left static getCurrentBundleName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left bundleInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleManager AST#expression#Right . getBundleInfoForSelfSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getCurrentBundleName(): string {
const bundleInfo = bundleManager.getBundleInfoForSelfSync(0);
return bundleInfo.name;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ReviewUtils.ets#L106-L109
|
a03f0862169912684a95f96877d735f72ada19b9
|
github
|
knight6236/Pomodoro-Timer.git
|
7810017895bdfaad31cb5b664edd08a712272080
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
DeleteDialogBuilder
|
定义删除确认对话框内容
|
@Builder
DeleteDialogBuilder() {
Column() {
Text('确认删除')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ top: 16, bottom: 16 })
Text(this.taskToDelete ? `是否删除任务"${this.taskToDelete.title}"?` : '')
.fontSize(16)
.fontColor(this.themeColors.textSecondary)
.margin({ bottom: 20 })
.textAlign(TextAlign.Center)
Row() {
Button('取消')
.width('40%')
.height(40)
.backgroundColor(this.themeColors.textSecondary)
.margin({ top: 20, right: 8 })
.onClick(() => {
this.deleteDialogController.close();
this.taskToDelete = null;
})
Button('删除')
.width('40%')
.height(40)
.backgroundColor(this.themeColors.primary)
.margin({ top: 20, left: 8 })
.onClick(() => {
if (this.taskToDelete) {
this.deleteTask(this.taskToDelete);
}
this.deleteDialogController.close();
this.taskToDelete = null;
})
}
.width('90%')
.justifyContent(FlexAlign.SpaceAround)
}
.width('90%')
.padding(16)
.backgroundColor(Color.White)
.borderRadius(24)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeleteDialogBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '确认删除' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskToDelete AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` 是否删除任务" AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskToDelete AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right "? ` AST#template_literal#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . themeColors AST#member_expression#Right AST#expression#Right . textSecondary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '取消' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '40%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . themeColors AST#member_expression#Right AST#expression#Right . textSecondary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deleteDialogController AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskToDelete AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '删除' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '40%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . themeColors AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskToDelete AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deleteTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskToDelete AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deleteDialogController AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskToDelete AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
DeleteDialogBuilder() {
Column() {
Text('确认删除')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ top: 16, bottom: 16 })
Text(this.taskToDelete ? `是否删除任务"${this.taskToDelete.title}"?` : '')
.fontSize(16)
.fontColor(this.themeColors.textSecondary)
.margin({ bottom: 20 })
.textAlign(TextAlign.Center)
Row() {
Button('取消')
.width('40%')
.height(40)
.backgroundColor(this.themeColors.textSecondary)
.margin({ top: 20, right: 8 })
.onClick(() => {
this.deleteDialogController.close();
this.taskToDelete = null;
})
Button('删除')
.width('40%')
.height(40)
.backgroundColor(this.themeColors.primary)
.margin({ top: 20, left: 8 })
.onClick(() => {
if (this.taskToDelete) {
this.deleteTask(this.taskToDelete);
}
this.deleteDialogController.close();
this.taskToDelete = null;
})
}
.width('90%')
.justifyContent(FlexAlign.SpaceAround)
}
.width('90%')
.padding(16)
.backgroundColor(Color.White)
.borderRadius(24)
}
|
https://github.com/knight6236/Pomodoro-Timer.git/blob/7810017895bdfaad31cb5b664edd08a712272080/entry/src/main/ets/pages/Index.ets#L121-L166
|
00d14b1051ef557c15422621df9fbf4010130685
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
Weather/product/default/src/main/ets/pages/HoursWeather.ets
|
arkts
|
[EndExclude HoursWeather]
|
build() {
// Implement extensibility capability through list component.
List() {
LazyForEach(this.hoursDataResource, (hoursItem: Forecast) => {
ListItem() {
this.HoursWeatherItem(hoursItem,
this.curBp === 'lg' ? Style.WEATHER_ITEM_WIDTH + 2 : Style.WEATHER_ITEM_WIDTH)
}
}, (hoursItem: Forecast, index: number) => JSON.stringify(hoursItem) + index)
}
.width('100%')
.height(Style.CARD_HEIGHT)
.borderRadius(Style.NORMAL_RADIUS)
.backgroundColor(Style.CARD_BACKGROUND_COLOR)
.listDirection(Axis.Horizontal)
}
|
AST#build_method#Left build ( ) AST#build_body#Left { // Implement extensibility capability through list component. AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hoursDataResource AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left hoursItem : AST#type_annotation#Left AST#primary_type#Left Forecast AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . HoursWeatherItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hoursItem AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curBp AST#member_expression#Right AST#expression#Right === AST#expression#Left 'lg' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . WEATHER_ITEM_WIDTH AST#member_expression#Right AST#expression#Right + AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left Style AST#expression#Right AST#conditional_expression#Right AST#expression#Right . WEATHER_ITEM_WIDTH AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left hoursItem : AST#type_annotation#Left AST#primary_type#Left Forecast AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hoursItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . CARD_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . NORMAL_RADIUS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Style AST#expression#Right . CARD_BACKGROUND_COLOR AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
List() {
LazyForEach(this.hoursDataResource, (hoursItem: Forecast) => {
ListItem() {
this.HoursWeatherItem(hoursItem,
this.curBp === 'lg' ? Style.WEATHER_ITEM_WIDTH + 2 : Style.WEATHER_ITEM_WIDTH)
}
}, (hoursItem: Forecast, index: number) => JSON.stringify(hoursItem) + index)
}
.width('100%')
.height(Style.CARD_HEIGHT)
.borderRadius(Style.NORMAL_RADIUS)
.backgroundColor(Style.CARD_BACKGROUND_COLOR)
.listDirection(Axis.Horizontal)
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/product/default/src/main/ets/pages/HoursWeather.ets#L64-L79
|
613733f19af4f3472ff2636dcebd2836d2d3ad23
|
gitee
|
|
xt1314520/IbestKnowTeach
|
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
|
entry/src/main/ets/api/ArticleContentApi.type.ets
|
arkts
|
分页查询最热文章内容入参
|
export interface ArticleContentHotPageParam extends PageParam {
/**
* 标题
*/
title: string
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ArticleContentHotPageParam AST#extends_clause#Left extends PageParam AST#extends_clause#Right AST#object_type#Left { /**
* 标题
*/ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ArticleContentHotPageParam extends PageParam {
title: string
}
|
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/ArticleContentApi.type.ets#L76-L82
|
97bf5500ad28028584490a9ddc676e44976739eb
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/sns/qq/QQLoginManager.ets
|
arkts
|
loginWithCallback
|
登录方法 - 回调方式
|
public loginWithCallback(callback: SnsOneLoginCallback): void {
this.SnsOneLoginCallback = callback;
if (!this.iQQOpenApi) {
this.handleLoginError('QQOpenApi not initialized');
return;
}
const loginApiCallback: ApiCallback<AuthResponse> = {
onComplete: (response: AuthResponse): void => {
DebugLog.d(`onComplete response: ${JSON.stringify(response)}`);
if (response.ret == 0) {
this.onAuthSuccess(response);
} else {
this.handleLoginError(`Auth failed with ret: ${response.ret}`);
}
},
onError: (msg: string | null): void => {
this.handleLoginError(`onError: ${msg}`);
},
onCancel: (msg: string | null): void => {
this.handleLoginError('Login canceled by user');
}
};
try {
this.iQQOpenApi.login({
scope: "all",
useQrCode: false,
networkTimeout: 0,
forceWebLogin: false
}, loginApiCallback);
} catch (error) {
this.handleLoginError(error);
}
}
|
AST#method_declaration#Left public loginWithCallback AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left SnsOneLoginCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . SnsOneLoginCallback AST#member_expression#Right = AST#expression#Left callback AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . iQQOpenApi AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleLoginError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'QQOpenApi not initialized' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left loginApiCallback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ApiCallback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AuthResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onComplete AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left response : AST#type_annotation#Left AST#primary_type#Left AuthResponse AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onComplete response: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left response AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . ret AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onAuthSuccess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left response AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleLoginError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Auth failed with ret: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . ret AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onError AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleLoginError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onError: AST#template_substitution#Left $ { AST#expression#Left msg AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onCancel AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleLoginError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Login canceled by user' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iQQOpenApi AST#member_expression#Right AST#expression#Right . login AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left scope AST#property_name#Right : AST#expression#Left "all" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left useQrCode AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left networkTimeout AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left forceWebLogin AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left loginApiCallback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleLoginError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public loginWithCallback(callback: SnsOneLoginCallback): void {
this.SnsOneLoginCallback = callback;
if (!this.iQQOpenApi) {
this.handleLoginError('QQOpenApi not initialized');
return;
}
const loginApiCallback: ApiCallback<AuthResponse> = {
onComplete: (response: AuthResponse): void => {
DebugLog.d(`onComplete response: ${JSON.stringify(response)}`);
if (response.ret == 0) {
this.onAuthSuccess(response);
} else {
this.handleLoginError(`Auth failed with ret: ${response.ret}`);
}
},
onError: (msg: string | null): void => {
this.handleLoginError(`onError: ${msg}`);
},
onCancel: (msg: string | null): void => {
this.handleLoginError('Login canceled by user');
}
};
try {
this.iQQOpenApi.login({
scope: "all",
useQrCode: false,
networkTimeout: 0,
forceWebLogin: false
}, loginApiCallback);
} catch (error) {
this.handleLoginError(error);
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/sns/qq/QQLoginManager.ets#L109-L144
|
1fff2ca04a361f99bd64b3f7fedd779e4f96fa98
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/h5cache/Index.ets
|
arkts
|
H5Cache
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { H5Cache } from './src/main/ets/pages/H5Cache';
|
AST#export_declaration#Left export { H5Cache } from './src/main/ets/pages/H5Cache' ; AST#export_declaration#Right
|
export { H5Cache } from './src/main/ets/pages/H5Cache';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/Index.ets#L15-L15
|
8ca8f03ebcfa7d5de0cd36aaf8c43172011f58b6
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customdialog/Index.ets
|
arkts
|
CustomDialogComponent
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { CustomDialogComponent } from './src/main/ets/view/CustomDialog';
|
AST#export_declaration#Left export { CustomDialogComponent } from './src/main/ets/view/CustomDialog' ; AST#export_declaration#Right
|
export { CustomDialogComponent } from './src/main/ets/view/CustomDialog';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/Index.ets#L15-L15
|
32928d2b22210b4f11ab508f672fdeca6c2e3363
|
gitee
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets
|
arkts
|
transForm
|
处理函数,将weekdata[],allTime,allCalorie装入
|
transForm(datas:dailyWorkOutType[]){
let weekInfo:DailyWorkout[]=[];
datas.forEach((item,idx)=>{
weekInfo.push({calorie:item.allCalories,stime:item.allTime})
})
return weekInfo;
}
|
AST#method_declaration#Left transForm AST#parameter_list#Left ( AST#parameter#Left datas : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left dailyWorkOutType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left weekInfo : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DailyWorkout [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left datas AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right , AST#parameter#Left idx AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left weekInfo AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left calorie AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . allCalories AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left stime AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . allTime AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left weekInfo AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
transForm(datas:dailyWorkOutType[]){
let weekInfo:DailyWorkout[]=[];
datas.forEach((item,idx)=>{
weekInfo.push({calorie:item.allCalories,stime:item.allTime})
})
return weekInfo;
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets#L335-L341
|
38295515d4b7c9c22f72f99826484221863136a0
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets
|
arkts
|
deleteCustomResource
|
删除自定义来源
|
public deleteCustomResource(key: number) {
const list = key > 200 ? this._resource.income : this._resource.expense;
const idx = list.findIndex((item) => item.key === key)!;
if (typeof idx === 'number') {
list.splice(idx, 1);
return true;
}
return false;
}
|
AST#method_declaration#Left public deleteCustomResource AST#parameter_list#Left ( AST#parameter#Left key : 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#Left const AST#variable_declarator#Left list = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left key AST#expression#Right > AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _resource AST#member_expression#Right AST#expression#Right . income AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . _resource AST#member_expression#Right AST#expression#Right . expense AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left idx = AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left list AST#expression#Right . findIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . key AST#member_expression#Right AST#expression#Right === AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left idx AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'number' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left list AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left idx AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public deleteCustomResource(key: number) {
const list = key > 200 ? this._resource.income : this._resource.expense;
const idx = list.findIndex((item) => item.key === key)!;
if (typeof idx === 'number') {
list.splice(idx, 1);
return true;
}
return false;
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets#L136-L144
|
88eb3a746452e6425ffbff8f6b2ad54f287d33bb
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/pipwindow/src/main/ets/model/PipManager.ets
|
arkts
|
onActionEvent
|
监听画中画控制面板控件动作事件
|
onActionEvent(control: PiPWindow.ControlEventParam) {
switch (control.controlType) {
// 视频播放、停止
case PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE:
if (control.status === PiPWindow.PiPControlStatus.PAUSE) {
// 停止视频
PipManager.getInstance().player.isPlaying = false;
} else if (control.status === PiPWindow.PiPControlStatus.PLAY) {
// 播放视频
PipManager.getInstance().player.isPlaying = true;
}
break;
// 切换到下一个视频
case PiPWindow.PiPControlType.VIDEO_NEXT:
break;
// 切换到上一个视频
case PiPWindow.PiPControlType.VIDEO_PREVIOUS:
break;
// 视频进度快进
case PiPWindow.PiPControlType.FAST_FORWARD:
break;
// 视频进度后退
case PiPWindow.PiPControlType.FAST_BACKWARD:
break;
default:
break;
}
logger.info('onActionEvent, controlType:' + control.controlType + ', status' + control.status);
}
|
AST#method_declaration#Left onActionEvent AST#parameter_list#Left ( AST#parameter#Left control : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left PiPWindow . ControlEventParam AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left control AST#expression#Right . controlType AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { // 视频播放、停止 AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PiPWindow AST#expression#Right . PiPControlType AST#member_expression#Right AST#expression#Right . VIDEO_PLAY_PAUSE AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : AST#ERROR#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left control AST#expression#Right . status AST#member_expression#Right AST#expression#Right === AST#expression#Left PiPWindow AST#expression#Right AST#binary_expression#Right AST#expression#Right . PiPControlStatus AST#member_expression#Right AST#expression#Right . PAUSE AST#member_expression#Right AST#expression#Right ) { // 停止视频 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PipManager AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . player AST#member_expression#Right AST#expression#Right . isPlaying AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left control AST#expression#Right . status AST#member_expression#Right AST#expression#Right === AST#expression#Left PiPWindow AST#expression#Right AST#binary_expression#Right AST#expression#Right . PiPControlStatus AST#member_expression#Right AST#expression#Right . PLAY AST#member_expression#Right AST#expression#Right ) { // 播放视频 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PipManager AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . player AST#member_expression#Right AST#expression#Right . isPlaying AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right ; AST#expression_statement#Right // 切换到下一个视频 AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PiPWindow AST#expression#Right . PiPControlType AST#member_expression#Right AST#expression#Right . VIDEO_NEXT AST#member_expression#Right AST#expression#Right AST#ERROR#Left : break AST#ERROR#Right ; AST#expression_statement#Right // 切换到上一个视频 AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PiPWindow AST#expression#Right . PiPControlType AST#member_expression#Right AST#expression#Right . VIDEO_PREVIOUS AST#member_expression#Right AST#expression#Right AST#ERROR#Left : break AST#ERROR#Right ; AST#expression_statement#Right // 视频进度快进 AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PiPWindow AST#expression#Right . PiPControlType AST#member_expression#Right AST#expression#Right . FAST_FORWARD AST#member_expression#Right AST#expression#Right AST#ERROR#Left : break AST#ERROR#Right ; AST#expression_statement#Right // 视频进度后退 AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PiPWindow AST#expression#Right . PiPControlType AST#member_expression#Right AST#expression#Right . FAST_BACKWARD AST#member_expression#Right AST#expression#Right AST#ERROR#Left : break AST#ERROR#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left break AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'onActionEvent, controlType:' AST#expression#Right + AST#expression#Left control AST#expression#Right AST#binary_expression#Right AST#expression#Right . controlType AST#member_expression#Right AST#expression#Right + AST#expression#Left ', status' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left control AST#expression#Right AST#binary_expression#Right AST#expression#Right . status AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
onActionEvent(control: PiPWindow.ControlEventParam) {
switch (control.controlType) {
case PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE:
if (control.status === PiPWindow.PiPControlStatus.PAUSE) {
PipManager.getInstance().player.isPlaying = false;
} else if (control.status === PiPWindow.PiPControlStatus.PLAY) {
PipManager.getInstance().player.isPlaying = true;
}
break;
case PiPWindow.PiPControlType.VIDEO_NEXT:
break;
case PiPWindow.PiPControlType.VIDEO_PREVIOUS:
break;
case PiPWindow.PiPControlType.FAST_FORWARD:
break;
case PiPWindow.PiPControlType.FAST_BACKWARD:
break;
default:
break;
}
logger.info('onActionEvent, controlType:' + control.controlType + ', status' + control.status);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/PipManager.ets#L56-L84
|
5c2965fef9bfe1bd78adef8eb669775bfb5c26b4
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_core/src/main/ets/core/base/OutDTO.ets
|
arkts
|
OKByDataTable
|
成功-包含多行数据
@param msg 提示消息
@param dataTable 多行数据
@param dataRow 单行数据(不传)
@returns
|
static OKByDataTable<T>(msg: string, dataTable: Array<T>, dataRow?: T): OutDTO<T> {
if (!dataRow) {
dataRow = Object as T;
}
let dto = new OutDTO<T>(true, msg, dataRow, dataTable, 200);
return dto;
}
|
AST#method_declaration#Left static OKByDataTable AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataTable : 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 T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataRow ? : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left dataRow AST#expression#Right AST#unary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left dataRow = AST#expression#Left AST#as_expression#Left AST#expression#Left Object AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left dto = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left OutDTO AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left msg AST#expression#Right , AST#expression#Left dataRow AST#expression#Right , AST#expression#Left dataTable AST#expression#Right , AST#expression#Left 200 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left dto AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static OKByDataTable<T>(msg: string, dataTable: Array<T>, dataRow?: T): OutDTO<T> {
if (!dataRow) {
dataRow = Object as T;
}
let dto = new OutDTO<T>(true, msg, dataRow, dataTable, 200);
return dto;
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/base/OutDTO.ets#L88-L94
|
30d349730192fb735c3027ed6d400e10dbd793c3
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/common/types/ContactTypes.ets
|
arkts
|
联系人统计信息接口
|
export interface ContactStatistics {
total: number;
byRelation: Record<RelationType, number>;
byGender: Record<Gender, number>;
byAge: AgeDistribution;
upcomingBirthdays: UpcomingBirthdayStats;
averageIntimacyLevel: number;
favoriteCount: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ContactStatistics AST#object_type#Left { AST#type_member#Left total : 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 byRelation : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RelationType AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left byGender : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Gender AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left byAge : AST#type_annotation#Left AST#primary_type#Left AgeDistribution AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left upcomingBirthdays : AST#type_annotation#Left AST#primary_type#Left UpcomingBirthdayStats AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left averageIntimacyLevel : 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 favoriteCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ContactStatistics {
total: number;
byRelation: Record<RelationType, number>;
byGender: Record<Gender, number>;
byAge: AgeDistribution;
upcomingBirthdays: UpcomingBirthdayStats;
averageIntimacyLevel: number;
favoriteCount: number;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/ContactTypes.ets#L180-L188
|
48721d8417eed4c0ff0dea6eb9ef73368f8e259a
|
github
|
|
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
|
128861bc002adae9c34c6ce8fbf12686c26e51ec
|
entry/src/main/ets/pages/TenantManagerPage.ets
|
arkts
|
onCancel
|
@author: wuwenqiang
@description: 关闭弹窗
@date: 2025-09-20 13:21
|
onCancel(){
this.dialogController?.close();
}
|
AST#method_declaration#Left onCancel AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogController AST#member_expression#Right AST#expression#Right ?. close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
onCancel(){
this.dialogController?.close();
}
|
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/pages/TenantManagerPage.ets#L79-L81
|
b780697e5c03586320d73fb9b4b765c66bf29d91
|
github
|
kico0909/crazy_miner.git
|
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
|
entry/src/main/ets/common/game/core/world.ets
|
arkts
|
createActionEvent
|
每一次挖掘,触发的动作
创建具体动作内容
|
function createActionEvent(world: WORLD, stepLong: number): t.TMinerActionEventItem {
const luck = world.player.attr.luck
const luckRand = utils.getRandomInt(0, 100)
if (luckRand <= luck + stepLong) { // 触发特殊事件
// 获得一个特殊事件 分类
const eventType = utils.getRandomObjectByProbability<t.TTypeEventBox>(world.events)
// 获得一个特殊事件
const event = utils.getRandomObjectByProbability<t.TMinerActionEventItem>(eventType.items)
return event
} else { // 普通事件直接返回
console.warn('world.events', JSON.stringify(world.events))
const event = utils.getRandomObjectByProbability<t.TMinerActionEventItem>(world.events[t.EnumEventTypeSort.default].items)
return event
}
}
|
AST#function_declaration#Left function createActionEvent AST#parameter_list#Left ( AST#parameter#Left world : AST#type_annotation#Left AST#primary_type#Left WORLD AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stepLong : 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#qualified_type#Left t . TMinerActionEventItem AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left luck = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . player AST#member_expression#Right AST#expression#Right . attr AST#member_expression#Right AST#expression#Right . luck AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left luckRand = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utils AST#expression#Right . getRandomInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 100 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left luckRand AST#expression#Right <= AST#expression#Left AST#binary_expression#Left AST#expression#Left luck AST#expression#Right + AST#expression#Left stepLong AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 触发特殊事件 // 获得一个特殊事件 分类 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left eventType = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utils AST#expression#Right . getRandomObjectByProbability AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left t . TTypeEventBox AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . events AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 获得一个特殊事件 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left event = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utils AST#expression#Right . getRandomObjectByProbability AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left t . TMinerActionEventItem AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left eventType AST#expression#Right . items AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left event AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 普通事件直接返回 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'world.events' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . events AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left event = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utils AST#expression#Right . getRandomObjectByProbability AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left t . TMinerActionEventItem AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left world AST#expression#Right . events AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left t AST#expression#Right . EnumEventTypeSort AST#member_expression#Right AST#expression#Right . default AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . items AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left event AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function createActionEvent(world: WORLD, stepLong: number): t.TMinerActionEventItem {
const luck = world.player.attr.luck
const luckRand = utils.getRandomInt(0, 100)
if (luckRand <= luck + stepLong) {
const eventType = utils.getRandomObjectByProbability<t.TTypeEventBox>(world.events)
const event = utils.getRandomObjectByProbability<t.TMinerActionEventItem>(eventType.items)
return event
} else {
console.warn('world.events', JSON.stringify(world.events))
const event = utils.getRandomObjectByProbability<t.TMinerActionEventItem>(world.events[t.EnumEventTypeSort.default].items)
return event
}
}
|
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/world.ets#L64-L78
|
9d158ea7a403ab8aa4e52c8b5b4e4f204c98fcde
|
github
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.