在canvas下 img.onload不被觸發,不知道什么原因,在前面也已經加了判斷快取.....不知道什么原因就是沒有加載....請大家幫我看一下~謝謝。
if (img.complete) {
img.onload = function () {
console.log(1111) // 輸出的1111 也一直沒出現
cans.drawImage(
img, // 規定要使用的影像、畫布或視頻。
0,
0, // 開始剪切的 x 坐標位置。
img.width,
img.height, // 被剪切影像的高度。
-200,
(can.height) / 2.4, // 在畫布上放置影像的 x 、y坐標位置。
170,
90 // 要使用的影像的寬度、高度
)
}
img.src = require('../../../assets/download.png')
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/281588.html
標籤:JavaScript
上一篇:前端CSS引入HTML的參考說明
