1. 程式人生 > >Vue static 靜態資源路徑 和 style問題

Vue static 靜態資源路徑 和 style問題

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    // 靜態資源輸出到二級目錄下
    assetsSubDirectory: 'static',
    // 靜態資源cdn地址
    assetsPublicPath: '/',

引用的時候可直接,不用返回上一級去查詢,因為編譯輸出後的 static  下的資源 跟 html 是在同一個目錄

<img class="navbar-brand-logo" src="static/logo.png"></a>

如果單個vue檔案裡的 style 沒有用到 最好刪除掉 不然 html頁面會自動生成一個 空的style