如何调试背景图像不显示的原因?
How can I debug why the background image is not displaying?
我有一些代码that works with Angular, that does not work with Vue.js。
bodyElement.style.setProperty('background-image', 'url(./assets/pictures/pexels-chevanon-photography-1108099.jpg)');
bodyElement.style.setProperty('background-size', 'cover');
这里是 Angular file tree structure and the Vue.js file tree structure.
如何调试问题?
背景问题已解决:我将背景图片放在“public”文件夹中。
要更改元素背景图片,您可以使用以下代码:
bodyElement.style.backgroundImage='url(./assets/pictures/pexels-chevanon-photography-1108099.jpg)';
bodyElement.style.backgroundSize='cover';
我有一些代码that works with Angular, that does not work with Vue.js。
bodyElement.style.setProperty('background-image', 'url(./assets/pictures/pexels-chevanon-photography-1108099.jpg)');
bodyElement.style.setProperty('background-size', 'cover');
这里是 Angular file tree structure and the Vue.js file tree structure.
如何调试问题?
背景问题已解决:我将背景图片放在“public”文件夹中。
要更改元素背景图片,您可以使用以下代码:
bodyElement.style.backgroundImage='url(./assets/pictures/pexels-chevanon-photography-1108099.jpg)';
bodyElement.style.backgroundSize='cover';