Skip to content

Commit 093e542

Browse files
authored
Merge pull request #9 from PanJiaChen/master
pull
2 parents 7d089df + 3625f92 commit 093e542

File tree

14 files changed

+44
-39
lines changed

14 files changed

+44
-39
lines changed

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ cd vue-element-admin
161161
# 安装依赖
162162
npm install
163163

164-
# 建议不要用 cnpm 安装 会有各种诡异的bug 可以通过如下操作解决 npm 下载速度慢的问题
164+
# 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
165165
npm install --registry=https://registry.npm.taobao.org
166166

167167
# 启动服务

jest.config.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
module.exports = {
2-
verbose: true,
32
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
4-
transformIgnorePatterns: [
5-
'node_modules/(?!(babel-jest|jest-vue-preprocessor)/)'
6-
],
73
transform: {
84
'^.+\\.vue$': 'vue-jest',
9-
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
5+
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
6+
'jest-transform-stub',
107
'^.+\\.jsx?$': 'babel-jest'
118
},
129
moduleNameMapper: {

mock/mock-server.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const chokidar = require('chokidar')
22
const bodyParser = require('body-parser')
33
const chalk = require('chalk')
4+
const path = require('path')
5+
6+
const mockDir = path.join(process.cwd(), 'mock')
47

58
function registerRoutes(app) {
69
let mockLastIndex
@@ -18,7 +21,7 @@ function registerRoutes(app) {
1821

1922
function unregisterRoutes() {
2023
Object.keys(require.cache).forEach(i => {
21-
if (i.includes('/mock')) {
24+
if (i.includes(mockDir)) {
2225
delete require.cache[require.resolve(i)]
2326
}
2427
})
@@ -40,9 +43,8 @@ module.exports = app => {
4043
var mockStartIndex = mockRoutes.mockStartIndex
4144

4245
// watch files, hot reload mock server
43-
chokidar.watch(('./mock'), {
44-
ignored: 'mock/mock-server.js',
45-
persistent: true,
46+
chokidar.watch(mockDir, {
47+
ignored: /mock-server/,
4648
ignoreInitial: true
4749
}).on('all', (event, path) => {
4850
if (event === 'change' || event === 'add') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build:stage": "vue-cli-service build --mode staging",
1111
"preview": "node build/index.js --preview",
1212
"lint": "eslint --ext .js,.vue src",
13-
"test:unit": "vue-cli-service test:unit",
13+
"test:unit": "jest --clearCache && vue-cli-service test:unit",
1414
"test:ci": "npm run lint && npm run test:unit",
1515
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
1616
"new": "plop"

src/api/user.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ export function logout() {
2222
method: 'post'
2323
})
2424
}
25-

src/components/Sticky/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ export default {
4040
mounted() {
4141
this.height = this.$el.getBoundingClientRect().height
4242
window.addEventListener('scroll', this.handleScroll)
43-
window.addEventListener('resize', this.handleReize)
43+
window.addEventListener('resize', this.handleResize)
4444
},
4545
activated() {
4646
this.handleScroll()
4747
},
4848
destroyed() {
4949
window.removeEventListener('scroll', this.handleScroll)
50-
window.removeEventListener('resize', this.handleReize)
50+
window.removeEventListener('resize', this.handleResize)
5151
},
5252
methods: {
5353
sticky() {
@@ -81,7 +81,7 @@ export default {
8181
}
8282
this.handleReset()
8383
},
84-
handleReize() {
84+
handleResize() {
8585
if (this.isSticky) {
8686
this.width = this.$el.getBoundingClientRect().width + 'px'
8787
}

src/components/Tinymce/index.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :class="{fullscreen:fullscreen}" class="tinymce-container editor-container">
2+
<div :class="{fullscreen:fullscreen}" class="tinymce-container" :style="{width:containerWidth}">
33
<textarea :id="tinymceId" class="tinymce-textarea" />
44
<div class="editor-custom-btn-container">
55
<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" />
@@ -38,9 +38,14 @@ export default {
3838
default: 'file edit insert view format table'
3939
},
4040
height: {
41-
type: Number,
41+
type: [Number, String],
4242
required: false,
4343
default: 360
44+
},
45+
width: {
46+
type: [Number, String],
47+
required: false,
48+
default: 'auto'
4449
}
4550
},
4651
data() {
@@ -58,6 +63,13 @@ export default {
5863
computed: {
5964
language() {
6065
return this.languageTypeList[this.$store.getters.language]
66+
},
67+
containerWidth() {
68+
const width = this.width
69+
if (/^[\d]+(\.[\d]+)?$/.test(width)) { // matches `100`, `'100'`
70+
return `${width}px`
71+
}
72+
return width
6173
}
6274
},
6375
watch: {

src/layout/components/Navbar.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
{{ $t('navbar.github') }}
3737
</el-dropdown-item>
3838
</a>
39+
<a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
40+
<el-dropdown-item>Docs</el-dropdown-item>
41+
</a>
3942
<el-dropdown-item divided>
4043
<span style="display:block;" @click="logout">{{ $t('navbar.logOut') }}</span>
4144
</el-dropdown-item>
@@ -68,7 +71,6 @@ export default {
6871
computed: {
6972
...mapGetters([
7073
'sidebar',
71-
'name',
7274
'avatar',
7375
'device'
7476
])

src/store/getters.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const getters = {
1111
introduction: state => state.user.introduction,
1212
roles: state => state.user.roles,
1313
permission_routes: state => state.permission.routes,
14-
addRoutes: state => state.permission.addRoutes,
1514
errorLogs: state => state.errorLog.logs
1615
}
1716
export default getters

src/store/modules/permission.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const actions = {
5151
return new Promise(resolve => {
5252
let accessedRoutes
5353
if (roles.includes('admin')) {
54-
accessedRoutes = asyncRoutes
54+
accessedRoutes = asyncRoutes || []
5555
} else {
5656
accessedRoutes = filterAsyncRoutes(asyncRoutes, roles)
5757
}

0 commit comments

Comments
 (0)