1、打包之后展示空白页以及自提图标的问题
config index.js
assetsPublicPath加一个./,设置同级位置。
untils.js 中vue-style-loader 加一个publicPath:'../../',因为打包的路劲问题
2.vue设置浏览器标签title和icon
<link rel="shortcut icon" type="image/x-icon" href="./static/data/favicon.ico">
一定要ico的图标不然没用
title:
(1)每个页面都加上
mounted() {
//测试
document.title = "Holle World";
}
(2)还有设置路由
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/views/HelloWorld'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'HelloWorld',
component: HelloWorld,
meta:{
title:'你好,世界!'
}
}
]
})
以及main.js中添加路由过滤
router.beforeEach((to, form, next) => {
if (to.meta.title) {
document.title = to.meta.title;
}
next();
})