av-cliper.js:3 Uncaught (in promise) TypeError: Cannot read from private field
Closed this issue · 1 comments
foreverdxy commented
cvs.on('activeSpriteChange', (sprite) => {
if (sprite) {
setPrevSpr(sprite);
}
});
我在这个方法里面保存了上一次剪辑的sprite。
当我再次使用 await avCvs?.addSprite(prevSpr)的时候,就报错了;
av-cliper.js:3 Uncaught (in promise) TypeError: Cannot read from private field
at ki (av-cliper.js:3:9)
at li (av-cliper.js:6:97)
at p (av-cliper.js:7:23)
at fn.getClip (av-cliper.js:7249:12)
at je.addSprite (av-canvas.js:412:19)
at _callee$ (index.tsx:99:14)
at tryCatch (regeneratorRuntime.js:44:17)
at Generator.<anonymous> (regeneratorRuntime.js:125:22)
at Generator.next (regeneratorRuntime.js:69:21)
at asyncGeneratorStep (asyncToGenerator.js:3:24)
hughfenghen commented
不要直接保存被添加的 sprite,
如果要复用 sprite 对象,尝试保存它的 clone 对象 setPrevSpr(await sprite.clone())