Vue-element-admin: run build之后为什么无法登录?

Created on 13 Aug 2017  ·  8Comments  ·  Source: PanJiaChen/vue-element-admin

按照wiki里的方法,run build测试环境和生产环境均无法登录,求解

构建

Most helpful comment

npm run build 出来的 index.html 直接打开没用的,需要起一个服务器,比如用 python:

$ cd dist/
$ python -m SimpleHTTPServer 8080

All 8 comments

提供信息太少,无为定位

按照reademe里给的方法,npm run build:sit-preview以及npm run build:prod后,均会产生dist文件夹为生产环境,可这里的index页面打开后是登录页面,输入帐号密码后无法登录,也没有报错。。。 不知为什么 没找到原因

mock api 服务器有时候会挂掉

@WiXiM 那您知道怎么解决这个问题吗? 我这两天一直在研究 没搞明白

npm run build 出来的 index.html 直接打开没用的,需要起一个服务器,比如用 python:

$ cd dist/
$ python -m SimpleHTTPServer 8080

@wyudong 搞定了,用的node服务。谢谢指点。。我可能之前被误导了,之前看的vue的demo都是build后直接打开就行,登录等功能都可以。。。 这个为何不可 了解得不是很透彻 没搞懂

@Dennisliu1988 登录不了的原因 本地打开index.html 走的是 file:// 协议无法写入 cookie 但这里会去读取cookie 来判断是否有登录,所以导致了你所说的现象。

@PanJiaChen 谢谢大神悉心指点,这回懂了。涨知识使我快乐~~~

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yanlee26 picture yanlee26  ·  3Comments

cqzongjian picture cqzongjian  ·  4Comments

Mr-arvin picture Mr-arvin  ·  4Comments

eladcandroid picture eladcandroid  ·  4Comments

XiaoLizi29 picture XiaoLizi29  ·  3Comments