Vue部署

  1 分钟   1835 字    |    

Vue部署

打包

  1. config中的index.js里build下修改webpack配置:
assetsPublicPath: '/dist/' 
  1. router中的index.js配置中加上:
export default new Router({
mode: 'history',
scrollBehavior: () => ({ y: 0 }),
base: '/dist/', // 加上这一行
routes: constantRouterMap
})
  1. 打包build:
npm run build

安装Apache2

  1. 安装:yum install httpd
  2. 配置:vim /etc/httpd/conf/httpd.conf
  3. 启动:systemctl start httpd.service
  4. 开机启动:systemctl enable httpd.service

部署

  1. 将vue工程中的dist文件夹移动到/var/www/html/下:mv dist /var/www/html/

  2. 访问: localhost:[port]/dist/

参考

[ 1 ] http://www.codebaoku.com/it-js/it-js-205207.html

[ 2 ] https://www.jianshu.com/p/5b8903709e66

~  ~  The   End  ~  ~


 赏 
感谢您的支持,我会继续努力哒!
支付宝收款码
tips
文章二维码 分类标签:技术vue
文章标题:Vue部署
文章链接:http://120.46.217.131:82/archives/35/
最后编辑:2022 年 9 月 17 日 21:19 By Yang
许可协议: 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)

相关推荐

热门推荐

(*) 6 + 7 =
快来做第一个评论的人吧~