美文网首页
vue项目打包本地运行查看

vue项目打包本地运行查看

作者: lesdom | 来源:发表于2019-05-29 13:11 被阅读0次

方式一

config - index.js
assetsPublicPath中的/改为./
router - index.js
不要配置mode: "history"

注意

这种方式打包上线之后路由不能跳转,所以记得修改回来
assetsPublicPath中的./改为/

方式二 http-server

需要先安装node

npm install http-server -g

进入打包后的目录(命令行)

http-server

会出现

Starting up http-server, serving ./
Available on:
  http://10.6.60.191:8080
  http://127.0.0.1:8080
Hit CTRL-C to stop the server

此时,在浏览器请求http://10.6.60.191:8080/index.html

提示

可能有用,也可能没有用。
我用vue-cli新建的项目可以,但是用我本地的项目不可以。

网站导航

网站导航

相关文章

网友评论

      本文标题:vue项目打包本地运行查看

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