我正在尝试将图像显示为我的应用程序的背景,并且我尝试使用 ImageView,代码自爆:
bg-img = TUI.create-image-view({
image: ev.media
left: 0
top: 0
border-width: 2
border-color: "red"
# width: img-width + "px"
# height: img-height + "px"
})
bg-img.width = 2754
bg-img.height = 4896
# pic-img.add bg-img
bg-img.add-event-listener \click, !(ev)->
log \clicked-on-pic-img
_this.trigger \click-edit-pic-view, ev
# # inspect pic-img
_this.Els.pic-container.add bg-img
图像不会出现在屏幕上,但如果我减去 bg-img 的大小,例如:
bg-img = TUI.create-image-view({
image: ev.media
left: 0
top: 0
border-width: 2
border-color: "red"
# width: img-width + "px"
# height: img-height + "px"
})
bg-img.width = 2754 / 3
bg-img.height = 4896 / 3
# pic-img.add bg-img
bg-img.add-event-listener \click, !(ev)->
log \clicked-on-pic-img
_this.trigger \click-edit-pic-view, ev
# # inspect pic-img
_this.Els.pic-container.add bg-img
它无法正常运行,我不知道为什么?o(╯□╰)o 有人可以帮忙吗?谢谢!