deploy
Pan 2019-05-27 17:04:00 +08:00
commit 591f928d22
12 changed files with 67 additions and 26 deletions

View File

@ -1,5 +1,5 @@
language: node_js language: node_js
node_js: stable node_js: 10
script: npm run test script: npm run test
notifications: notifications:
email: false email: false

View File

@ -14,10 +14,10 @@ English | [简体中文](./README-zh.md)
```bash ```bash
# clone the project # clone the project
git clone https://github.com/PanJiaChen/vue-element-admin.git git clone https://github.com/PanJiaChen/vue-admin-template.git
# enter the project directory # enter the project directory
cd vue-element-admin cd vue-admin-template
# install dependency # install dependency
npm install npm install
@ -26,7 +26,7 @@ npm install
npm run dev npm run dev
``` ```
This will automatically open http://localhost:9527 This will automatically open http://localhost:9528
## Build ## Build

View File

@ -48,17 +48,21 @@ module.exports = app => {
ignoreInitial: true ignoreInitial: true
}).on('all', (event, path) => { }).on('all', (event, path) => {
if (event === 'change' || event === 'add') { if (event === 'change' || event === 'add') {
// remove mock routes stack try {
app._router.stack.splice(mockStartIndex, mockRoutesLength) // remove mock routes stack
app._router.stack.splice(mockStartIndex, mockRoutesLength)
// clear routes cache // clear routes cache
unregisterRoutes() unregisterRoutes()
const mockRoutes = registerRoutes(app) const mockRoutes = registerRoutes(app)
mockRoutesLength = mockRoutes.mockRoutesLength mockRoutesLength = mockRoutes.mockRoutesLength
mockStartIndex = mockRoutes.mockStartIndex mockStartIndex = mockRoutes.mockStartIndex
console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`)) console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`))
} catch (error) {
console.log(chalk.redBright(error))
}
} }
}) })
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "vue-admin-template", "name": "vue-admin-template",
"version": "4.1.0", "version": "4.2.1",
"description": "A vue admin template with Element UI & axios & iconfont & permission control & lint", "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint",
"author": "Pan <panfree23@gmail.com>", "author": "Pan <panfree23@gmail.com>",
"license": "MIT", "license": "MIT",
@ -35,6 +35,7 @@
"@vue/cli-plugin-unit-jest": "3.6.3", "@vue/cli-plugin-unit-jest": "3.6.3",
"@vue/cli-service": "3.6.0", "@vue/cli-service": "3.6.0",
"@vue/test-utils": "1.0.0-beta.29", "@vue/test-utils": "1.0.0-beta.29",
"autoprefixer": "^9.5.1",
"babel-core": "7.0.0-bridge.0", "babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1", "babel-eslint": "10.0.1",
"babel-jest": "23.6.0", "babel-jest": "23.6.0",
@ -60,7 +61,6 @@
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
"last 2 versions", "last 2 versions"
"not ie <= 8"
] ]
} }

View File

@ -1,10 +1,14 @@
<template> <template>
<svg :class="svgClass" aria-hidden="true" v-on="$listeners"> <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
<svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
<use :xlink:href="iconName" /> <use :xlink:href="iconName" />
</svg> </svg>
</template> </template>
<script> <script>
// doc: https://panjiachen.github.io/vue-element-admin-site/feature/component/svg-icon.html#usage
import { isExternal } from '@/utils/validate'
export default { export default {
name: 'SvgIcon', name: 'SvgIcon',
props: { props: {
@ -18,6 +22,9 @@ export default {
} }
}, },
computed: { computed: {
isExternal() {
return isExternal(this.iconClass)
},
iconName() { iconName() {
return `#icon-${this.iconClass}` return `#icon-${this.iconClass}`
}, },
@ -27,6 +34,12 @@ export default {
} else { } else {
return 'svg-icon' return 'svg-icon'
} }
},
styleExternalIcon() {
return {
mask: `url(${this.iconClass}) no-repeat 50% 50%`,
'-webkit-mask': `url(${this.iconClass}) no-repeat 50% 50%`
}
} }
} }
} }
@ -40,4 +53,10 @@ export default {
fill: currentColor; fill: currentColor;
overflow: hidden; overflow: hidden;
} }
.svg-external-icon {
background-color: currentColor;
mask-size: cover!important;
display: inline-block;
}
</style> </style>

View File

@ -11,7 +11,7 @@ export default {
name: 'AppMain', name: 'AppMain',
computed: { computed: {
key() { key() {
return this.$route.fullPath return this.$route.path
} }
} }
} }
@ -29,3 +29,12 @@ export default {
padding-top: 50px; padding-top: 50px;
} }
</style> </style>
<style lang="scss">
// fix css style bug in open el-dialog
.el-popup-parent--hidden {
.fixed-header {
padding-right: 15px;
}
}
</style>

View File

@ -47,7 +47,7 @@ export default {
}, },
methods: { methods: {
handleClickOutside() { handleClickOutside() {
this.$store.dispatch('CloseSideBar', { withoutAnimation: false }) this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
} }
} }
} }

View File

@ -22,8 +22,18 @@ Vue.use(VueAnalytics, {
router router
}) })
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online! ! !
*/
import { mockXHR } from '../mock' import { mockXHR } from '../mock'
mockXHR() if (process.env.NODE_ENV === 'production') {
mockXHR()
}
// set ElementUI lang to EN // set ElementUI lang to EN
Vue.use(ElementUI, { locale }) Vue.use(ElementUI, { locale })

View File

@ -95,10 +95,6 @@
margin-left: 54px; margin-left: 54px;
} }
.svg-icon {
margin-right: 0px;
}
.submenu-title-noDropdown { .submenu-title-noDropdown {
padding: 0 !important; padding: 0 !important;
position: relative; position: relative;

View File

@ -48,7 +48,7 @@ service.interceptors.response.use(
// if the custom code is not 20000, it is judged as an error. // if the custom code is not 20000, it is judged as an error.
if (res.code !== 20000) { if (res.code !== 20000) {
Message({ Message({
message: res.message || 'error', message: res.message || 'Error',
type: 'error', type: 'error',
duration: 5 * 1000 duration: 5 * 1000
}) })
@ -66,7 +66,7 @@ service.interceptors.response.use(
}) })
}) })
} }
return Promise.reject(res.message || 'error') return Promise.reject(new Error(res.message || 'Error'))
} else { } else {
return res return res
} }

View File

@ -7,6 +7,9 @@ function resolve(dir) {
} }
const name = defaultSettings.title || 'vue Admin Template' // page title const name = defaultSettings.title || 'vue Admin Template' // page title
// If your port is set to 80,
// use administrator privileges to execute the command line.
// For example, Mac: sudo npm run
const port = 9528 // dev port const port = 9528 // dev port
// All configuration item explanations can be find in https://cli.vuejs.org/config/ // All configuration item explanations can be find in https://cli.vuejs.org/config/
@ -34,7 +37,7 @@ module.exports = {
// change xxx-api/login => mock/login // change xxx-api/login => mock/login
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://localhost:${port}/mock`, target: `http://127.0.0.1:${port}/mock`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''