美文网首页
vue项目如何部署到服务器

vue项目如何部署到服务器

作者: 琳媚儿 | 来源:发表于2020-06-17 21:35 被阅读0次

第一步配置 vue.config.js

module.exports = {
    publicPath: './'
}

第二步修改路由,改为 hash模式

const router = new VueRouter({
  mode: 'hash'
})

第三步文件打包,执行以下,目录中会出现一个dist文件夹,将文件拖到服务器的root文件夹中

npm run build

第四步可以通过域名进行访问 http://www.linlin.run/my-project/index.html#/home

相关文章

网友评论

      本文标题:vue项目如何部署到服务器

      本文链接:https://www.haomeiwen.com/subject/vysexktx.html