1.当loadSrc参数传入为undefined时,结束gif循环和原有的canvas数据内容

Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
zhoulisheng1 2023-03-24 09:44:21 +08:00
parent 065abc6686
commit d77539c555
1 changed files with 8 additions and 4 deletions

View File

@ -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);