├── .gitignore
├── README.md
├── babel.config.js
├── package-lock.json
├── package.json
├── public
├── favicon.ico
└── index.html
├── src
├── App.vue
├── api
│ ├── axios.js
│ ├── config.js
│ └── index.js
├── assets
│ ├── logo.png
│ └── tabbar
│ │ ├── home.png
│ │ ├── home_sel.png
│ │ ├── me.png
│ │ └── me_sel.png
├── common
│ └── stylus
│ │ ├── base.styl
│ │ ├── index.styl
│ │ ├── mixin.styl
│ │ ├── modifyUI.styl
│ │ ├── reset.styl
│ │ └── variable.styl
├── components
│ ├── HeaderTop.vue
│ ├── NoData.vue
│ ├── footBar.vue
│ └── images
│ │ └── NoData.png
├── main.js
├── router
│ └── index.js
├── store
│ └── index.js
├── utils
│ ├── index.js
│ └── utils.js
└── views
│ ├── home.vue
│ └── me.vue
└── vue.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 | pnpm-debug.log*
14 |
15 | # Editor directories and files
16 | .idea
17 | .vscode
18 | *.suo
19 | *.ntvs*
20 | *.njsproj
21 | *.sln
22 | *.sw?
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # my-project-templ
2 | ```
3 | 基于版本vue2.6的
4 | 一个集成移动端开发插件的Vue移动端模板
5 | 包含
6 | 1、css:
7 | 使用stylus开发css
8 | 集成reset样式文件
9 | 修改UI组件文件
10 | 统一样式处理(如主题色等)
11 | 2、UI组件
12 | 使用热门的移动端vue组件库vant
13 | 按需加载
14 | 3、移动端适配
15 | 集成rem插件
16 | 移动端适配META标签
17 | 4、组件
18 | 集成标题栏组件、无数据组件
19 | 5、请求
20 | 集成axios封装请求接口
21 | 6、babel
22 | ES6转ES5
23 | 7、vue全家桶
24 | vue+vuex+vue-router
25 | 8、VConsole调试
26 | (index.html中)
27 | 满足日常应用开发
28 | ```
29 | ## Project setup
30 | ```
31 | npm install
32 | ```
33 |
34 | ### Compiles and hot-reloads for development
35 | ```
36 | npm run serve
37 | ```
38 |
39 | ### Compiles and minifies for production
40 | ```
41 | npm run build
42 | ```
43 |
44 | ### Lints and fixes files
45 | ```
46 | npm run lint
47 | ```
48 |
49 | ### Customize configuration
50 | See [Configuration Reference](https://cli.vuejs.org/config/).
51 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ],
5 | plugins: [
6 | ['import', {
7 | libraryName: 'vant',
8 | libraryDirectory: 'es',
9 | style: true
10 | }, 'vant']
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-project-templ",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "npm run serve",
7 | "serve": "vue-cli-service serve",
8 | "build": "vue-cli-service build",
9 | "lint": "vue-cli-service lint"
10 | },
11 | "dependencies": {
12 | "amfe-flexible": "^2.2.1",
13 | "axios": "^0.19.2",
14 | "core-js": "^3.6.5",
15 | "postcss-px2rem": "^0.3.0",
16 | "vant": "^2.8.7",
17 | "vue": "^2.6.11",
18 | "vue-router": "^3.2.0",
19 | "vuex": "^3.4.0"
20 | },
21 | "devDependencies": {
22 | "@vue/cli-plugin-babel": "~4.4.0",
23 | "@vue/cli-plugin-eslint": "~4.4.0",
24 | "@vue/cli-plugin-router": "~4.4.0",
25 | "@vue/cli-plugin-vuex": "~4.4.0",
26 | "@vue/cli-service": "~4.4.0",
27 | "babel-eslint": "^10.1.0",
28 | "babel-plugin-import": "^1.13.0",
29 | "eslint": "^6.7.2",
30 | "eslint-plugin-vue": "^6.2.2",
31 | "stylus": "^0.54.7",
32 | "stylus-loader": "^3.0.2",
33 | "vue-template-compiler": "^2.6.11"
34 | },
35 | "eslintConfig": {
36 | "root": true,
37 | "env": {
38 | "node": true
39 | },
40 | "extends": [
41 | "plugin:vue/essential",
42 | "eslint:recommended"
43 | ],
44 | "parserOptions": {
45 | "parser": "babel-eslint"
46 | },
47 | "rules": {}
48 | },
49 | "postcss": {
50 | "plugins": {
51 | "autoprefixer": {},
52 | "postcss-px2rem": {
53 | "remUnit": 37.5
54 | }
55 | }
56 | },
57 | "browserslist": [
58 | "> 1%",
59 | "last 2 versions",
60 | "not dead"
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lpz1096/vueProMobileTemplate/b27925fb1c10f385680169e083ddcb2fe5385db0/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
9 | <%= htmlWebpackPlugin.options.title %>
10 |
11 |
12 |
13 |
14 | <%= htmlWebpackPlugin.options.title %>
15 |
16 |
18 |
19 |
20 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
16 |
20 |
--------------------------------------------------------------------------------
/src/api/axios.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import { baseURL } from './config'
3 | /**
4 | * 请求函数
5 | * @param url 请求路径
6 | * @param data 请求参数
7 | * @param method 请求类型
8 | * @param isError 错误是否返回
9 | * @param isDownExcel 是否下载Excel
10 | **/
11 | // 定义私有方法
12 | const _request = Symbol('_request')
13 | const _interceptors = Symbol('_interceptors')
14 | const _getConfig = Symbol('_getConfig')
15 | class HttpRequest {
16 | [_request] (url, data, method, isError) {
17 | const http = axios.create()
18 | var options = {
19 | url,
20 | data,
21 | method
22 | }
23 | options = Object.assign(this[_getConfig](), options)
24 | this[_interceptors](http, isError)
25 | return http(options)
26 | }
27 | [_interceptors] (http, isError) {
28 | // 请求拦截
29 | http.interceptors.request.use(config => {
30 | config.headers = {
31 | // 设置请求头
32 | 'Authorization': localStorage.getItem('Authorization')
33 | }
34 | return config
35 | })
36 | // 响应拦截
37 | http.interceptors.response.use(res => {
38 | const { data } = res
39 |
40 | // 公共处理请求完毕数据
41 | // 请求失败
42 | if (data.ack === 0) {
43 | if (isError) {
44 | return data
45 | } else {
46 | window.VW.$message.warning(data.msg)
47 | }
48 | } else {
49 | return isError ? data : data.data
50 | }
51 | }, err => {
52 | console.log(err)
53 | })
54 | }
55 | // 创建实例时设置配置的默认值
56 | [_getConfig] () {
57 | return {
58 | baseURL
59 | }
60 | }
61 | // post请求
62 | post (url, data = {}, isError = false) {
63 | return this[_request](url, data, 'post', isError)
64 | }
65 | // get请求
66 | get (url, data = {}, isError = false) {
67 | // 封装get参数
68 | let dataStr = '?'
69 | Object.keys(data)
70 | .forEach(key => {
71 | dataStr += key + '=' + data[key] + '&'
72 | })
73 | if (dataStr !== '') {
74 | dataStr = dataStr.substring(0, dataStr.lastIndexOf('&'))
75 | url = url + dataStr
76 | }
77 | return this[_request](url, {}, 'get', isError)
78 | }
79 | // delete请求
80 | delete (url, data = {}, isError = false) {
81 | return this[_request](url, data, 'delete', isError)
82 | }
83 | // put请求
84 | put (url, data = {}, isError = false) {
85 | return this[_request](url, data, 'put', isError)
86 | }
87 | }
88 |
89 | export default HttpRequest
90 |
--------------------------------------------------------------------------------
/src/api/config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 请求数据配置
3 | * 配置编译环境和线上环境之间的IP切换
4 | *
5 | * baseURL: 域名地址
6 | * fileUpBaseUrl:上传文件
7 | **/
8 | var baseURL = ''
9 | var fileUpBaseUrl = ''
10 |
11 | if (process.env.NODE_ENV === 'development') {
12 | baseURL = '/apiPath'
13 | fileUpBaseUrl = ''
14 | } else {
15 | baseURL = ''
16 | fileUpBaseUrl = ''
17 | }
18 | export {
19 | baseURL,
20 | fileUpBaseUrl
21 | }
22 |
--------------------------------------------------------------------------------
/src/api/index.js:
--------------------------------------------------------------------------------
1 | import HttpRequest from './axios'
2 | const request = new HttpRequest()
3 | /**
4 | * 获取类目
5 | */
6 | export const getCategoryList = () => request.post('/category/list')
7 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lpz1096/vueProMobileTemplate/b27925fb1c10f385680169e083ddcb2fe5385db0/src/assets/logo.png
--------------------------------------------------------------------------------
/src/assets/tabbar/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lpz1096/vueProMobileTemplate/b27925fb1c10f385680169e083ddcb2fe5385db0/src/assets/tabbar/home.png
--------------------------------------------------------------------------------
/src/assets/tabbar/home_sel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lpz1096/vueProMobileTemplate/b27925fb1c10f385680169e083ddcb2fe5385db0/src/assets/tabbar/home_sel.png
--------------------------------------------------------------------------------
/src/assets/tabbar/me.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lpz1096/vueProMobileTemplate/b27925fb1c10f385680169e083ddcb2fe5385db0/src/assets/tabbar/me.png
--------------------------------------------------------------------------------
/src/assets/tabbar/me_sel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lpz1096/vueProMobileTemplate/b27925fb1c10f385680169e083ddcb2fe5385db0/src/assets/tabbar/me_sel.png
--------------------------------------------------------------------------------
/src/common/stylus/base.styl:
--------------------------------------------------------------------------------
1 | @import "variable.styl"
2 | //在线字体
3 | @font-face
4 | font-family: 'webfont';
5 | src: url('//at.alicdn.com/t/webfont_mj93c8yato.eot'); /* IE9*/
6 | src: url('//at.alicdn.com/t/webfont_mj93c8yato.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
7 | url('//at.alicdn.com/t/webfont_mj93c8yato.woff') format('woff'), /* chrome、firefox */
8 | url('//at.alicdn.com/t/webfont_mj93c8yato.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
9 | url('//at.alicdn.com/t/webfont_mj93c8yato.svg#NotoSansHans-DemiLight') format('svg'); /* iOS 4.1- */
10 |
11 | body, html
12 | line-height: 1
13 | font-family:"webfont" !important;
14 | user-select: none
15 | -webkit-tap-highlight-color: transparent
16 | background: $color-background
17 | color: $color-text
18 | -webkit-overflow-scrolling: touch
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/common/stylus/index.styl:
--------------------------------------------------------------------------------
1 | @import "./reset.styl"
2 | @import "./base.styl"
3 | @import "./modifyUI.styl"
4 |
--------------------------------------------------------------------------------
/src/common/stylus/mixin.styl:
--------------------------------------------------------------------------------
1 | @import "./variable.styl"
2 | // 背景图片
3 | bg-image($url)
4 | background-image: url($url + "@2x.png")
5 | @media (-webkit-min-device-pixel-ratio: 3),(min-device-pixel-ratio: 3)
6 | background-image: url($url + "@3x.png")
7 |
8 | // 不换行
9 | no-wrap()
10 | text-overflow: ellipsis
11 | overflow: hidden
12 | white-space: nowrap
13 |
14 | // 扩展点击区域
15 | extend-click()
16 | position: relative
17 | &:before
18 | content: ''
19 | position: absolute
20 | top: -10px
21 | left: -10px
22 | right: -10px
23 | bottom: -10px
24 | // 一像素下边框
25 | bottom-border-1px($color)
26 | position relative
27 | border none
28 | &:after
29 | content ''
30 | position absolute
31 | left 0
32 | bottom 0
33 | width 100%
34 | height 1px
35 | background-color $color
36 | transform scaleY(0.5)
37 |
38 | // 一像素上边框
39 | top-border-1px($color)
40 | position relative
41 | &::before
42 | content ''
43 | position absolute
44 | z-index 200
45 | left 0
46 | top 0
47 | width 100%
48 | height 1px
49 | background-color $color
50 |
51 | //根据像素比缩放1px像素边框
52 | @media only screen and (-webkit-device-pixel-ratio: 2 )
53 | .border-1px
54 | &::before
55 | transform scaleY(.5)
56 |
57 | @media only screen and (-webkit-device-pixel-ratio: 3 )
58 | .border-1px
59 | &::before
60 | transform scaleY(.333333)
61 | //有标题界面初始化高度
62 | init-height()
63 | width 100%
64 | height 100%
65 | position absolute
66 | left 0
67 | top $header-title-height
68 |
--------------------------------------------------------------------------------
/src/common/stylus/modifyUI.styl:
--------------------------------------------------------------------------------
1 | /**
2 | 修改UI组件样式
3 | */
4 | @import "./variable.styl"
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/common/stylus/reset.styl:
--------------------------------------------------------------------------------
1 | /**
2 | * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
3 | * http://cssreset.com
4 | */
5 | html, body, div, span, applet, object, iframe,
6 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
7 | a, abbr, acronym, address, big, cite, code,
8 | del, dfn, em, img, ins, kbd, q, s, samp,
9 | small, strike, strong, sub, sup, tt, var,
10 | b, u, i, center,
11 | dl, dt, dd, ol, ul, li,
12 | fieldset, form, label, legend,
13 | table, caption, tbody, tfoot, thead, tr, th, td,
14 | article, aside, canvas, details, embed,
15 | figure, figcaption, footer, header,
16 | menu, nav, output, ruby, section, summary,
17 | time, mark, audio, video, input
18 | margin: 0
19 | padding: 0
20 | border: 0
21 | font-size: 100%
22 | font-weight: normal
23 | vertical-align: baseline
24 |
25 | /* HTML5 display-role reset for older browsers */
26 | article, aside, details, figcaption, figure,
27 | footer, header, menu, nav, section
28 | display: block
29 |
30 | body
31 | line-height: 1
32 |
33 | blockquote, q
34 | quotes: none
35 |
36 | blockquote:before, blockquote:after,
37 | q:before, q:after
38 | content: none
39 |
40 | table
41 | border-collapse: collapse
42 | border-spacing: 0
43 |
44 | /* custom */
45 |
46 | a
47 | color: #7e8c8d
48 | -webkit-backface-visibility: hidden
49 | text-decoration: none
50 |
51 | li
52 | list-style: none
53 |
54 | body
55 | -webkit-text-size-adjust: none
56 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0)
57 |
--------------------------------------------------------------------------------
/src/common/stylus/variable.styl:
--------------------------------------------------------------------------------
1 | // 颜色定义规范
2 | $color-background = #f4f4f4 //背景色
3 | $color-theme = #595BB3 //主题颜色
4 |
5 |
6 |
7 | //字体定义规范
8 | $font-size-small-s = 10px
9 | $font-size-small = 12px
10 | $font-size-medium = 14px
11 | $font-size-medium-x = 16px
12 | $font-size-large = 18px
13 | $font-size-large-x = 22px
14 |
15 | //高度定义规范
16 | $header-title-height = 45px
17 | $header-footer-height = 50px
18 | $header-input-height = 44px
19 |
20 | //宽度定义规范
21 | $card-theme-margin = 10px //卡片式布局间隙
22 |
23 |
--------------------------------------------------------------------------------
/src/components/HeaderTop.vue:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
18 |
19 |
44 |
--------------------------------------------------------------------------------
/src/components/NoData.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
暂无数据
5 |
6 |
7 |
8 |
13 |
14 |
26 |
--------------------------------------------------------------------------------
/src/components/footBar.vue:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
36 |
69 |
--------------------------------------------------------------------------------
/src/components/images/NoData.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lpz1096/vueProMobileTemplate/b27925fb1c10f385680169e083ddcb2fe5385db0/src/components/images/NoData.png
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 | import utils from './utils'
6 | import 'amfe-flexible'
7 | //初始化样式
8 | import './common/stylus/index.styl'
9 | Vue.config.productionTip = false
10 |
11 | Vue.use(utils)
12 | import { Button } from 'vant';
13 | Vue.use(Button)
14 | new Vue({
15 | router,
16 | store,
17 | render: h => h(App)
18 | }).$mount('#app')
19 |
--------------------------------------------------------------------------------
/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueRouter from 'vue-router'
3 | import Home from '../views/home.vue'
4 |
5 | Vue.use(VueRouter)
6 |
7 | const routes = [
8 | {
9 | path: '/',
10 | name: 'Home',
11 | component: Home,
12 | meta: {
13 | title: '首页',
14 | isMenu: true
15 | }
16 | },
17 | {
18 | path: '/me',
19 | name: 'Me',
20 | component: () => import('../views/me.vue'),
21 | meta: {
22 | title: '我的',
23 | isMenu: true
24 | }
25 | }
26 | ]
27 |
28 | const router = new VueRouter({
29 | mode: 'history',
30 | base: process.env.BASE_URL,
31 | routes
32 | })
33 |
34 | export default router
35 |
--------------------------------------------------------------------------------
/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | export default new Vuex.Store({
7 | state: {
8 | },
9 | mutations: {
10 | },
11 | actions: {
12 | },
13 | modules: {
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/src/utils/index.js:
--------------------------------------------------------------------------------
1 | import UTILS from './utils.js'
2 |
3 | const UtilPlugin={}
4 |
5 | UtilPlugin.install=function(Vue){
6 | Vue.prototype.$utils=UTILS
7 | }
8 | export default UtilPlugin
9 |
--------------------------------------------------------------------------------
/src/utils/utils.js:
--------------------------------------------------------------------------------
1 | class Utils {
2 | //构造函数
3 | constructor(){
4 | this.instance=null;
5 | }
6 | //单例模式
7 | static getInstance(){
8 | if(!this.instance){
9 | this.instance = new Utils();
10 | }
11 | return this.instance;
12 | }
13 |
14 | /**
15 | * 获取当前时间(毫秒值)
16 | * @returns {number}
17 | */
18 | getNowTimeStamp(){
19 | return new Date().getTime()
20 | }
21 |
22 | /**
23 | * 获取URL中的?后面的参数
24 | * @returns {string}
25 | */
26 | getUrlParam(){
27 | return document.location.toString().split("?")[1]
28 | }
29 |
30 |
31 | /**
32 | * 存储localStorage
33 | */
34 | setStore(name, content){
35 | if (!name) return
36 | if (typeof content !== 'string') {
37 | content = JSON.stringify(content)
38 | }
39 | window.localStorage.setItem(name, content)
40 | }
41 |
42 | /**
43 | * 获取localStorage
44 | */
45 | getStore(name){
46 | if (!name) return
47 | return window.localStorage.getItem(name)
48 | }
49 | /**
50 | * 删除localStorage
51 | */
52 | removeStore(name){
53 | if (!name) return
54 | window.localStorage.removeItem(name)
55 | }
56 | /**
57 | * 存储sessionStorage
58 | */
59 | setSessionStore(name, content){
60 | if (!name) return
61 | if (typeof content !== 'string') {
62 | content = JSON.stringify(content)
63 | }
64 | window.sessionStorage.setItem(name, content)
65 | }
66 |
67 | /**
68 | * 获取sessionStorage
69 | */
70 | getSessionStore(name){
71 | if (!name) return
72 | return window.sessionStorage.getItem(name)
73 | }
74 | /**
75 | * 删除sessionStorage
76 | */
77 | removeSessionStore(name){
78 | if (!name) return
79 | window.sessionStorage.removeItem(name)
80 | }
81 |
82 | /**
83 | * 排序工具类
84 | * 依据数组中对象的某个属性排序
85 | * @param property 属性
86 | * @param sort 升序降序 boolean
87 | * @returns {function(*, *): number}
88 | */
89 | compareSort(property,sort){
90 | return (a,b) =>{
91 | return sort?a[property] - b[property]:b[property] - a[property]
92 | }
93 | }
94 |
95 | /**
96 | * 判断是否为空
97 | */
98 | isNull(str){
99 | return str !== undefined && str !== null && str != ''
100 | }
101 |
102 | /**
103 | * 生成guid随机数
104 | * @returns {string}
105 | */
106 | guid(){
107 | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
108 | var r = Math.random() * 16 | 0,
109 | v = c == 'x' ? r : (r & 0x3 | 0x8);
110 | return v.toString(16);
111 | })
112 | }
113 | /**
114 | * 判断设备 Android/IOS
115 | */
116 | getUserDevice = () => {
117 | let request = ''
118 | let u = navigator.userAgent
119 | let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 //android终端或者uc浏览器
120 | let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) //ios终端!
121 | if (isAndroid) {
122 | request = {
123 | isAndroid:true
124 | }
125 | }
126 | if (isiOS) {
127 | request = request = {
128 | isIOS:true
129 | }
130 | }
131 | return request
132 | }
133 | }
134 | const UTILS = Utils.getInstance()
135 |
136 | export default UTILS
137 |
--------------------------------------------------------------------------------
/src/views/home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Vue移动端模板
6 |
9 |
10 |
11 |
12 |
29 |
33 |
--------------------------------------------------------------------------------
/src/views/me.vue:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
31 |
36 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devServer: {
3 | proxy: {
4 | "apiPath": {
5 | target: "需要跨域请求的地址",
6 | changeOrigin: true,
7 | pathRewrite: {
8 | "^/apiPath": "/",
9 | }
10 | },
11 | }
12 | }
13 | };
14 |
--------------------------------------------------------------------------------