mirror of
https://gitee.com/openharmony/applications_app_samples
synced 2024-11-23 16:40:08 +00:00
修复图片编辑后显示蓝色背景
Signed-off-by: ywx1281445 <yuandongping@huawei.com>
This commit is contained in:
parent
e82b54c73a
commit
7bbc5dd71b
@ -49,7 +49,7 @@ export default class GetPictures {
|
||||
select.push(item);
|
||||
})
|
||||
}
|
||||
let imageList:Array<string> = AppStorage.Get('imageList') as Array<string>;
|
||||
let imageList:Array<string> = AppStorage.get('imageList') as Array<string>;
|
||||
AppStorage.setOrCreate<Array<string>>('imageList', imageList.concat(select));
|
||||
}
|
||||
}
|
||||
|
@ -41,14 +41,15 @@ struct Index {
|
||||
|
||||
aboutToAppear(): void {
|
||||
logger.info(TAG, 'enter aboutToAppear');
|
||||
if (AppStorage.Get<string[]>('pixelMaps')) {
|
||||
if (AppStorage.get<string[]>('pixelMaps')) {
|
||||
this.pixelMaps.push(undefined);
|
||||
}
|
||||
let rawFile = getContext().resourceManager.getRawFdSync("commodity.png");
|
||||
let imageSourceApi = image.createImageSource(rawFile);
|
||||
imageSourceApi.createPixelMap().then((pixelMap) => {
|
||||
this.commodityPixelMap = pixelMap;
|
||||
})
|
||||
});
|
||||
this.imageListChange();
|
||||
}
|
||||
|
||||
async imageListChange(): Promise<void> {
|
||||
|
@ -86,8 +86,8 @@ export struct UpdatePage {
|
||||
.width($r('app.float.size_100'))
|
||||
.onClick(() => {
|
||||
// 删除图片
|
||||
let imageList: Array<string> = AppStorage.Get('imageList') as Array<string>;
|
||||
let index: number = AppStorage.Get('selectIndex') as number;
|
||||
let imageList: Array<string> = AppStorage.get('imageList') as Array<string>;
|
||||
let index: number = AppStorage.get('selectIndex') as number;
|
||||
imageList.splice(index, 1);
|
||||
AppStorage.setOrCreate<Array<string>>('imageList', imageList);
|
||||
// 返回
|
||||
|
@ -74,8 +74,8 @@ async function saveFile(context: Context, data: ArrayBuffer): Promise<string> {
|
||||
|
||||
function setImageList(uri: string) {
|
||||
|
||||
let imageList: Array<string> | undefined = AppStorage.Get('imageList');
|
||||
const index: number | undefined = AppStorage.Get('selectIndex');
|
||||
let imageList: Array<string> | undefined = AppStorage.get('imageList');
|
||||
const index: number | undefined = AppStorage.get('selectIndex');
|
||||
if (imageList !== undefined && index !== undefined) {
|
||||
imageList[index] = uri;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user