溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

vue?template中style背景設(shè)置不編譯問題怎么解決

發(fā)布時間:2022-04-15 13:48:46 來源:億速云 閱讀:321 作者:iii 欄目:開發(fā)技術(shù)

這篇文章主要介紹了vue template中style背景設(shè)置不編譯問題怎么解決的相關(guān)知識,內(nèi)容詳細易懂,操作簡單快捷,具有一定借鑒價值,相信大家閱讀完這篇vue template中style背景設(shè)置不編譯問題怎么解決文章都會有所收獲,下面我們一起來看看吧。

    template中style背景設(shè)置不編譯

    在vue定義的組件當中,直接設(shè)置行內(nèi)style無法顯示背景,里面使用config.resolve.alias當中設(shè)置的 @等路徑符也無法識別

    <el-card  class="box-card" shadow="hover">

    解決方法

    在將圖片資源在vue 的 data當中解析再綁定到頁面

    <el-card : class="box-card" shadow="hover">
    // data當中定義 組件需要在函數(shù)當中返回數(shù)據(jù) 保證數(shù)據(jù)的作用域
    data: function(){
        return {
            weatherData:{},
            img: require('@assets/image/sunny_n.jpg')
        }
      },

    如何給template組件加背景

    <template>
      <div class="index_background" >
      </div>
    </template>
    <style>
    .index_background{ background: url('~@/../static/images/login-bg.png') center top no-repeat;}
    </style>

    關(guān)于“vue template中style背景設(shè)置不編譯問題怎么解決”這篇文章的內(nèi)容就介紹到這里,感謝各位的閱讀!相信大家對“vue template中style背景設(shè)置不編譯問題怎么解決”知識都有一定的了解,大家如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道。

    向AI問一下細節(jié)

    免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

    AI