Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#bug #3

Closed
BestDingSheng opened this issue Feb 22, 2017 · 7 comments
Closed

#bug #3

BestDingSheng opened this issue Feb 22, 2017 · 7 comments

Comments

@BestDingSheng
Copy link

项目打包后 豆瓣电影的api 地址就不对了
Uploading image.png…
怎么解决

@superman66
Copy link
Owner

api代理只能在开发环境下使用。
项目打包后,要想使用豆瓣的api,你得自己搭个后端的API转发,才能解决跨域问题。

@BestDingSheng
Copy link
Author

不会后端 ,大神有什么解决方案么。 axiso 有jsonp之类的跨域请求么

@superman66
Copy link
Owner

axios/axios#342
官方说了,axios并不支持jsonp。
我改天我再写个node,转发api的demo。

@BestDingSheng
Copy link
Author

哈哈哈 谢谢大神 能否加个QQ或者微信 不懂的可以请教下您

@superman66
Copy link
Owner

qq 673318522

@zhoucumt
Copy link

首先感谢楼主的分享,然后请教两个问题,还没来得及仔细研究,
1.为啥页面中审查DOM,发现id="app"的div不见了?是不是打包之后插入的地方有问题,导致直接覆盖了,然后id为app的div直接就消失了
2.页面中审查元素发现style标签很多而且有几个都是空内容,留下了很多空白,如下图:
image
@superman66

@superman66
Copy link
Owner

superman66 commented Mar 1, 2017

  1. id元素不见
    我觉得是因为webpack 在dev环境下,用了new HtmlWebpackPlugin而产生的。具体的原因有待研究。
  2. 空白style标签
    在dev环境下,vue-loader在编译.vue文件的时候,只要遇到<style>标签,便会将其编译成<style></style>内嵌到HTML中的header。出现空白是因为有几个vue单文件的<style></style>内是为空的,所以就会产生空白。我把vue单文件中空白的style都去掉后,这个问题便解决了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants