设置背景平铺,铺满正页面

问题遇到的现象和发生背景

vue中怎么设置背景平铺,铺满正页面,设置了但是图片显示不出来

用代码块功能插入代码,请勿粘贴截图
html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite Apptitle>
    <style>
        #building{
        background:url("../fruit/src/assets/1.3.png");
        width:100%;            //大小设置为100%
        height:100%;            //大小设置为100%
        position:fixed;
        background-size:100% 100%;}
        
        
    style>
  head>
  <body>
      <div id="building">
      div>
      
    <div id="app">div>
    <script type="module" src="/src/main.js">script>
  body>
html>


html部分

<image class="bg" src="../static/images/XXX.png"></image>

css部分


    .bg{
        position: fixed;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: -1;
    }

你审查一下元素:
①看id为building的盒子是否占满整个页面,没有的话设置高度100vh。
②你看一下引用的图片能否访问,不能的话就是路径错了

    height: 100vh;
    overflow: auto;
    background-image: url(/static/img/bg_login.4844c6a3.png);
    background-repeat: no-repeat;
    background-position-x: center;
    background-position-y: center;
    background-size: 100% 100%;

图片显示不出来 大概率 路径不对 。你可以试试网络图片 。如果可以 说明就是路径问题。 要用相对路径(可能还得用require引入)