Projects based on vue2, vue-router, vuex, axios, Douban API and Element UI framework
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
For detailed explanation on how things work, checkout the guide and docs for vue-loader.
├── App . vue
├── api
│ ├── base . js
│ └── movie . js
├── assets
│ └── logo . png
├── components
├── main . js
├── router
│ └── index . js
├── store
│ ├── index . js
│ └── movies
│ ├── module . js
│ └── type . js
└── views
├── Home . vue
├── NavMenu . vue
└── movie
├── MovieDetail . vue
└── MovieList . vue
Movie API:
/v2/movie/search?q={text}
movie search api; (not yet implemented)/v2/movie/in_theaters
currently showing;/v2/movie/coming_soon
movies;/v2/movie/subject/:id
single movie entry information.For more information about Douban API, you can go to the Douban API official website.
Douban API cross-domain configuration: Configure the proxy in /config/index.js
:
dev: {
env : require ( './dev.env' ) ,
port : 8880 ,
assetsSubDirectory : 'static' ,
assetsPublicPath : '/' ,
proxyTable : {
'/api' : {
target : 'http://api.douban.com/v2' ,
changeOrigin : true ,
pathRewrite : {
'^/api' : ''
}
}
}
}
In the proxyTable
attribute, configure the target attribute to the target address we want to proxy. Set to http://api.douban.com/v2
, so that we can call /api/movie/in_theaters
in the application to access http://api.douban.com/v2/movie/in_theaters
, thus solving cross-domain issues problem.
For more information on cross-domain settings of vue-cli, please see the official website documentation.