shishuangxi

清除缓存

... ... @@ -11,6 +11,7 @@ import fs from '@ohos.file.fs';
import { CustomCacheDialog } from './CustomCacheDialog';
import MineSettingDatasModel from '../../model/MineSettingDatasModel';
import { MineMainSettingFunctionItem } from '../../viewmodel/MineMainSettingFunctionItem';
import common from '@ohos.app.ability.common';
@Component
... ... @@ -279,18 +280,18 @@ export struct MineSettingComponent {
//删除缓存
deleteCache() {
// let context = getContext(this) as common.UIAbilityContext
// let application = context.getApplicationContext();
// let appPath = application.cacheDir
// Logger.debug("MineSettingComponent", appPath)
// fs.rmdir(appPath).then(() => {
// this.getCacheSize()
// })
// let path = context.cacheDir
// Logger.debug("MineSettingComponent", path)
// fs.rmdir(path).then(() => {
// this.getCacheSize()
// })
let context = getContext(this) as common.UIAbilityContext
let application = context.getApplicationContext();
let appPath = application.cacheDir
Logger.debug("MineSettingComponent", appPath)
fs.rmdir(appPath).then(() => {
this.getCacheSize()
})
let path = context.cacheDir
Logger.debug("MineSettingComponent", path)
fs.rmdir(path).then(() => {
this.getCacheSize()
})
}
getCacheSize() {
... ...