sqaiyan / neteasemusic Goto Github PK
View Code? Open in Web Editor NEWVue版仿网易云音乐ios端web spa
License: MIT License
Vue版仿网易云音乐ios端web spa
License: MIT License
Vue版打不开网页,我修改了端口还是不行
axios.defaults.baseURL = 'http://localhost:3000/v1/';
这里我修改了3000作为端口还是会报错
不知道是什么原因的
__
看到你写的路由router中有这样一段代码
{
path: '/simi/:id',
name: 'simi',
component: resolve => require(['@/pages/simi'], resolve)
}
这里component用函数的写法和先require相应的组件再component: 组件名
,这两者有什么区别吗?
新手,求解答!
搜索页的input中已经绑定了v-model 无需再用v-bind去双向绑定value值了吧,两者同时存在会导致编译出错
chrome Vue DevTools 这个项目不能使用,其他vue项目可以使用,是不是改了什么了,看了下没发现改动的地方
这个项目的原本接口是不是挂掉了,还有就是我修改了本地端口号还是开起不来项目,数据能够获取,但是就是渲染不上去
main.js 内引入了
import '@/assets/icon.css'
对应目录内没有相关文件
前后端部署成功后,会发现前端页面获取后端数据时,会出现跨域问题。翻阅服务端的代码,是可以看到是有处理跨域的(header.set('Access-Control-Allow-Origin', '*')),但是并没有生效。
解决跨域问题的几种常规方式:后端header加跨域设置(没生效),前端使用代理(开发环境有效,生产环境无效),使用nginx代理(生产、开发环境都可以)。
出于仅仅研究项目的目的,此处采用前端代理的方式,如下:
打开前端neteasemusic/src/main.js文件,做出以下修改
//axios.defaults.baseURL = 'http://localhost:3000/v1/';
axios.defaults.baseURL = '/api';
打开前端neteasemusic/config/index.js文件,做出以下修改
proxyTable: {
"/api": {
target: "http://localhost:3000/v1/", //设置你调用的接口域名和端口号
changeOrigin: true, //跨域
pathRewrite: {
"^/api": "/"
}
}
}
最后,重启前端项目就行了,跨域问题解决了。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.