vue-cli4打包后ico不显示的问题

来源:3-4 爬取数据的结构设计和存储

有没有没被占用的昵称

2020-04-22

老师,我在vue-cli4中使用了路由的history模式,发现favicon.icon在打包前是可以显示的,但是打包后就显示不出来了,请问老师是什么原因,应该如何解决

项目放在nginx的根目录下,直接通过localhost/index.html访问

public/index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,
      minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title>Sonic</title>
  </head>
  <body>
    <div id="app"></div>
  </body>
</html>

router/index.js

const router = new VueRouter({
  mode: 'history',
  base: '/',
  routes
})
写回答

2回答

Dell

2020-04-28

history 模式需要你在服务器上配置路径映射,你搜一下vue文档,有讲部署那快的内容,你需要在ng上做个配置

0
6
有没有没被占用的昵称
回复
Dell
希望老师下门课可以深入讲讲stylus 动画还有与原生交互的一些内容,谢谢老师
2020-04-30
共6条回复

Dell

2020-04-25

你看下<%= BASE_URL %>favicon.ico 这个文件是否存在于打包过后产生的目录中

0
4
有没有没被占用的昵称
回复
Dell
const routes = [ { path: '/login', component: Login }, { path: '/shipping/order', component: Order }, { path: '/route', component: Route }, { path: '/confirm', component: confirm } ] const router = new VueRouter({ mode: 'history', base: process.env.BASE_URL, routes }) export default router 上面是router下面的index.js,vue.config.js里面有这个 publicPath: './',
2020-04-28
共4条回复

专为小白设计的TypeScript入门课

Dell老师专为TypeScript小白打造的,全栈式教学TS入门课程

2213 学习 · 504 问题

查看课程