鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ vue-cli中history模式如何配置assetsPublicPath

vue-cli中history模式如何配置assetsPublicPath

使用vue-router的history模式后,assetsPublicPath定位錯誤,有什么辦法可以解決嗎?

// router 配置
const HistoryTest = () => import('@/components/HistoryTest')
Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/root/file',
      name: 'HistoryTest',
      component: HistoryTest,
    },
  ],
})

// HistoryText組件中
<img src="static/logo.png" alt="">

// 實際請求的URL
Request URL:http://localhost:48080/root/static/logo.png
回答
編輯回答
尋仙

應(yīng)該是<img src="static/logo.png" alt=""> ,少了個/

2017年8月29日 08:54