[英]How to render Vue Components over Html5-canvas
I would like to use an htmlcanvas a canvas as the background of a webpage and then have various Vuejs components rendered on top of it.我想使用 htmlcanvas 画布作为网页的背景,然后在其上呈现各种 Vuejs 组件。
I am sure the information is out there I just don't know what to search.我确定信息就在那里,我只是不知道要搜索什么。
You can style any element using CSS with position: absolute
to overlay the element on top of the canvas.您可以使用带有
position: absolute
CSS 来position: absolute
任何元素的样式,以将元素覆盖在画布顶部。
.container { position: relative; width: 300px; height: 300px; } .canvas { width: 300px; height: 300px; background-color: yellow; } .overlay { position: absolute; left: 20px; top: 20px; width: 100px; height: 100px; background-color: orange; }
<div class="container"> <canvas class="canvas"></canvas> <div class="overlay"> This is displayed on top of the canvas </div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.