diff --git a/library/src/main/ets/Index.ets b/library/src/main/ets/Index.ets index 1b34845..c526015 100644 --- a/library/src/main/ets/Index.ets +++ b/library/src/main/ets/Index.ets @@ -131,4 +131,4 @@ export { IDrawLifeCycle } from '@ohos/imageknife' export { LogUtil } from '@ohos/imageknife' // 额外开放初始化ImageKnife的方法 -export {InitImageKnife} from './src/main/ets/pages/InitImageKnife' \ No newline at end of file +export {InitImageKnife} from '../ets/pages/InitImageKnife' \ No newline at end of file diff --git a/library/src/main/ets/pages/Index.ets b/library/src/main/ets/pages/Index.ets index dc7606c..86f8d60 100644 --- a/library/src/main/ets/pages/Index.ets +++ b/library/src/main/ets/pages/Index.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ImageKnifeComponent, ImageKnifeOption, FileUtils } from '@ohos/imageknife' +import {ImageKnifeGlobal, ImageKnifeComponent, ImageKnifeOption, FileUtils } from '@ohos/imageknife' import common from '@ohos.app.ability.common' @Entry @@ -54,7 +54,8 @@ struct Index { Button('点击加载本地文件').onClick(()=>{ getContext(this).createModuleContext('library').resourceManager.getMediaContent($r('app.media.setting').id).then((data:Uint8Array)=>{ - let path = globalThis.ImageKnife.getImageKnifeContext().filesDir+"/set.jpeg"; + let ctx = ImageKnifeGlobal.getInstance().getHapContext() as common.UIAbilityContext; + let path = ctx.filesDir+"/set.jpeg"; FileUtils.getInstance().writeFile(path,data.buffer) FileUtils.getInstance().readFilePicAsync(path).then(buffer=>{ this.imageOption3 = {