基于vue的一个应用,奉壹杂记(小程序同名)
小程序二维码:
Wap端二维码:
vue-cli版本从2.9.6变为3.10.0
npm install
npm run serve
npm run build
npm run test
npm run lint
新建vue.config.js,添加配置:
publicPath: './',
// 将构建好的文件输出到哪里
outputDir: 'docs'
问题:
- 路由中配置model:history导致页面打包后空白
mode:'history',
base: '/fengyi', (配置为对应项目目录名,不然直接从根目录往下找) 本地开发不需要加该配置
-
v-html动态渲染内容添加样式
-
为每个页面动态添加标题
router.beforeEach((to,from,next) => {
if(to.meta.title){
document.title = to.meta.title
}
next() //执行后续代码操作
})