├── src
├── service
│ ├── api.js
│ └── http.js
├── assets
│ ├── logo.png
│ └── css
│ │ └── common.scss
├── components
│ ├── news.vue
│ ├── other.vue
│ └── HelloWorld.vue
└── views
│ ├── index
│ ├── app.js
│ └── App.vue
│ ├── other
│ ├── app.js
│ └── App.vue
│ └── news
│ ├── index
│ ├── app.js
│ └── App.vue
│ └── news_list
│ ├── app.js
│ └── App.vue
├── static
└── .gitkeep
├── config
├── test.env.js
├── prod.env.js
├── dev.env.js
└── index.js
├── title.js
├── .editorconfig
├── server.js
├── .gitignore
├── .babelrc
├── .postcssrc.js
├── dist_test
├── index.html
├── other
│ └── index.html
├── news
│ ├── index
│ │ └── index.html
│ └── news_list
│ │ └── index.html
└── static
│ └── js
│ ├── manifest.fa75d42566179fe51f57.js
│ ├── views
│ ├── news
│ │ ├── news_list.40b1ce84b46d57496a53.js
│ │ ├── index.c207920cc96775d8f614.js
│ │ ├── news_list.40b1ce84b46d57496a53.js.map
│ │ └── index.c207920cc96775d8f614.js.map
│ ├── other.05b37f39a839925e1118.js
│ ├── index.b9c39d046d6524a3989e.js
│ ├── other.05b37f39a839925e1118.js.map
│ └── index.b9c39d046d6524a3989e.js.map
│ ├── manifest.fa75d42566179fe51f57.js.map
│ └── vendor.0c979db204e3de767d5c.js
├── .eslintrc.js
├── package.json
├── index.html
└── README.md
/src/service/api.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/static/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/config/test.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | module.exports = {
3 | NODE_ENV: '"test"'
4 | }
5 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ecitlm/vue-mpa-cli/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/src/components/news.vue:
--------------------------------------------------------------------------------
1 |
2 | this is news page
3 |
4 |
--------------------------------------------------------------------------------
/src/components/other.vue:
--------------------------------------------------------------------------------
1 |
2 | this is other page
3 |
4 |
--------------------------------------------------------------------------------
/config/prod.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | module.exports = {
3 | NODE_ENV: '"production"'
4 | }
5 |
--------------------------------------------------------------------------------
/title.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | 'index': '首页',
3 | 'news/index': '新闻首页',
4 | 'news/new_list': '新闻-new_list',
5 | 'other': 'other'
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/config/dev.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const prodEnv = require('./prod.env')
4 |
5 | module.exports = merge(prodEnv, {
6 | NODE_ENV: '"development"'
7 | })
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/src/views/index/app.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 |
4 | Vue.config.productionTip = false
5 |
6 | /* eslint-disable no-new */
7 | new Vue({
8 | el: '#app',
9 | components: { App },
10 | template: ''
11 | })
12 |
--------------------------------------------------------------------------------
/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const app = express()
3 | app.use(express.static('./dist'))
4 | app.get('/', function (req, res) {
5 | res.send('Hello Vue-mpa-cli')
6 | })
7 |
8 | app.listen(2333)
9 | console.log('server start http://120.0.0.1:2333')
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | /dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | yarn.lock
8 | package-lock.json
9 | npm.lock
10 |
11 | # Editor directories and files
12 | .idea
13 | .vscode
14 | *.suo
15 | *.ntvs*
16 | *.njsproj
17 | *.sln
18 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false,
5 | "targets": {
6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7 | }
8 | }],
9 | "stage-2"
10 | ],
11 | "plugins": ["transform-vue-jsx", "transform-runtime"]
12 | }
13 |
--------------------------------------------------------------------------------
/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | "postcss-import": {},
6 | "postcss-url": {},
7 | // to edit target browsers: use "browserslist" field in package.json
8 | "autoprefixer": {}
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/views/other/app.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import App from './App.vue'
5 |
6 | Vue.config.productionTip = false
7 |
8 | /* eslint-disable no-new */
9 | new Vue({
10 | el: '#app',
11 | components: { App },
12 | template: ''
13 | })
14 |
--------------------------------------------------------------------------------
/src/views/news/index/app.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import App from './App.vue'
5 |
6 | Vue.config.productionTip = false
7 |
8 | /* eslint-disable no-new */
9 | new Vue({
10 | el: '#app',
11 | components: { App },
12 | template: ''
13 | })
14 |
--------------------------------------------------------------------------------
/src/views/news/news_list/app.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import App from './App.vue'
5 |
6 | Vue.config.productionTip = false
7 |
8 | /* eslint-disable no-new */
9 | new Vue({
10 | el: '#app',
11 | components: { App },
12 | template: ''
13 | })
14 |
--------------------------------------------------------------------------------
/src/views/news/news_list/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
this is news_list page
4 |
5 |
6 |
7 |
14 |
15 |
25 |
--------------------------------------------------------------------------------
/src/views/other/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
17 |
18 |
28 |
--------------------------------------------------------------------------------
/dist_test/index.html:
--------------------------------------------------------------------------------
1 | 首页
--------------------------------------------------------------------------------
/dist_test/other/index.html:
--------------------------------------------------------------------------------
1 | other
--------------------------------------------------------------------------------
/dist_test/news/index/index.html:
--------------------------------------------------------------------------------
1 | 新闻首页
--------------------------------------------------------------------------------
/dist_test/news/news_list/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/HelloWorld.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
首页
4 |
5 |
6 |
7 |
17 |
18 |
19 |
35 |
--------------------------------------------------------------------------------
/src/views/news/index/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
19 |
20 |
30 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // https://eslint.org/docs/user-guide/configuring
2 |
3 | module.exports = {
4 | root: true,
5 | parser: 'babel-eslint',
6 | parserOptions: {
7 | sourceType: 'module'
8 | },
9 | env: {
10 | browser: true,
11 | },
12 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md
13 | extends: 'standard',
14 | // required to lint *.vue files
15 | plugins: [
16 | 'html'
17 | ],
18 | // add your custom rules here
19 | rules: {
20 | // allow async-await
21 | 'generator-star-spacing': 'off',
22 | // allow debugger during development
23 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/dist_test/static/js/manifest.fa75d42566179fe51f57.js:
--------------------------------------------------------------------------------
1 | !function(r){var n=window.webpackJsonp;window.webpackJsonp=function(e,u,c){for(var f,i,p,a=0,l=[];a
2 |
10 |
11 |
12 |
22 |
23 |
54 |
--------------------------------------------------------------------------------
/src/service/http.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | let instance = axios.create({
3 | baseURL: process.env.BACK_BASE_URL,
4 | timeout: 60 * 1000
5 | })
6 | console.log(instance)
7 | // request拦截
8 | instance.interceptors.request.use(config => {
9 | config.headers.authorization = `token` // 头部设置token信息 可以拿vuex中数据
10 | return config
11 | }, error => {
12 | console.log('请求出错了...', error)
13 | return Promise.reject(error)
14 | })
15 |
16 | instance.interceptors.response.use(response => {
17 | if (response.data.code === 200) {
18 | // return response.data
19 | } else {
20 | console.log(response)
21 | let err = new Error()
22 | err.response = response
23 | return Promise.reject(err)
24 | }
25 | }, error => {
26 | return Promise.reject(error)
27 | })
28 |
29 | const httpRequest = (url, data = {}) => {
30 | return new Promise((resolve, reject) => {
31 | instance.post(url, data)
32 | .then(res => {
33 | resolve(res)
34 | })
35 | .catch(error => {
36 | if (error.response) {
37 | if (error.response.status === 200) {
38 | reject(error.response.data)
39 | }
40 | } else if (error.request) {
41 | if (error.code === 'ECONNABORTED') {
42 | // Toast({
43 | // message: '请求超时,请刷新重试',
44 | // className: 'error-net',
45 | // duration: 3000
46 | // })
47 | } else {
48 | console.log('网络断开,请检查网络')
49 | }
50 | } else {
51 | console.log('请求无响应')
52 | }
53 | })
54 | })
55 | }
56 |
57 | export default {
58 | login (data = {}) {
59 | return httpRequest('/api/login', data)
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/dist_test/static/js/views/news/news_list.40b1ce84b46d57496a53.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([3],{"5LYN":function(n,e,r){(n.exports=r("FZ+f")(!0)).push([n.i,"\n#app {\r\n font-family: 'Avenir', Helvetica, Arial, sans-serif;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: center;\r\n color: #2c3e50;\r\n margin-top: 60px;\n}\r\n","",{version:3,sources:["G:/Vue/vue-mpa-cli/src/views/news/news_list/src/views/news/news_list/App.vue"],names:[],mappings:";AAgBA;EACA,oDAAA;EACA,oCAAA;EACA,mCAAA;EACA,mBAAA;EACA,eAAA;EACA,iBAAA;CACA",file:"App.vue",sourcesContent:["\r\n \r\n
this is news_list page
\r\n \r\n \r\n\r\n\r\n
86 |
87 |
88 |