diff --git a/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets b/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets index 575cc14..11d4fcc 100644 --- a/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets +++ b/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets @@ -19,7 +19,7 @@ import { RequestOption } from '../imageknife/RequestOption' import { ImageKnifeData } from '../imageknife/ImageKnifeData' import { GIFFrame } from '../imageknife/utils/gif/GIFFrame' import { IDrawLifeCycle } from '../imageknife/interface/IDrawLifeCycle' -import {LogUtil} from '../imageknife/utils/LogUtil' +import { LogUtil } from '../imageknife/utils/LogUtil' @Component @@ -251,11 +251,15 @@ export struct ImageKnifeComponent { } // imageknife 第一次启动和数据刷新后重新发送请求 imageKnifeExecute() { - if(this.imageKnifeOption.loadSrc == null){ - // 如果数据是null或者undefined 则不进入图片请求流程 + if (this.imageKnifeOption.loadSrc == null) { + // 如果数据是null或者undefined,清空图片内容和gif循环,并且不进入图片请求流程 + this.resetGifData() + if (this.canvasHasReady) { + // 如果canvas已经初始化好了,清空原有的canvas内容 + this.context.clearRect(0, 0, this.currentWidth, this.currentHeight) + } return } - this.resetGifData() let request = new RequestOption(); this.configNecessary(request);