diff --git a/README.es.md b/README.es.md
index 734c51c2..396556f5 100644
--- a/README.es.md
+++ b/README.es.md
@@ -49,6 +49,7 @@ Vue Element Admin es una solución práctica basada en la nueva plataforma de de
- Plantilla base recomendada para usar: [vue-admin-template](https://github.com/PanJiaChen/vue-admin-template)
- Aplicación de Escritorio: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
- Plantilla de Typescript: [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Créditos: [@Armour](https://github.com/Armour))
+- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
**Después de la versión `v4.1.0+`, la rama por defecto master no tendrá soporte para i18n. Por favor use [i18n](https://github.com/PanJiaChen/vue-element-admin/tree/i18n), los cambios serán incluidos en la rama master**
diff --git a/README.ja.md b/README.ja.md
index e890e4f6..f0bc0ac1 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -45,6 +45,7 @@
- おすすめシンプルテンプレート: [vue-admin-template](https://github.com/PanJiaChen/vue-admin-template)
- デスクトップバージョン: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
- Typescriptバージョン: [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (鸣谢: [@Armour](https://github.com/Armour))
+- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
**After the `v4.1.0+` version, the default master branch will not support i18n. Please use [i18n Branch](https://github.com/PanJiaChen/vue-element-admin/tree/i18n), it will keep up with the master update**
diff --git a/README.md b/README.md
index cf4b74f6..3b93f971 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,7 @@ It is a magical vue admin based on the newest development stack of vue, built-in
- Base template recommends using: [vue-admin-template](https://github.com/PanJiaChen/vue-admin-template)
- Desktop: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
- Typescript: [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour))
+- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
**After the `v4.1.0+` version, the default master branch will not support i18n. Please use [i18n Branch](https://github.com/PanJiaChen/vue-element-admin/tree/i18n), it will keep up with the master update**
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 96a57757..78a88e4a 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -49,6 +49,7 @@
- 基础模板建议使用: [vue-admin-template](https://github.com/PanJiaChen/vue-admin-template)
- 桌面端: [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
- Typescript 版: [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (鸣谢: [@Armour](https://github.com/Armour))
+- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
**`v4.1.0+`版本之后默认 master 分支将不支持国际化,有需要的请使用[i18n](https://github.com/PanJiaChen/vue-element-admin/tree/i18n)分支,它会和 master 保持同步更新**
@@ -164,7 +165,7 @@ cd vue-element-admin
# 安装依赖
npm install
-# 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
+# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npm.taobao.org
# 启动服务
diff --git a/jsconfig.json b/jsconfig.json
new file mode 100644
index 00000000..958df046
--- /dev/null
+++ b/jsconfig.json
@@ -0,0 +1,9 @@
+{
+ "compilerOptions": {
+ "baseUrl": "./",
+ "paths": {
+ "@/*": ["src/*"]
+ }
+ },
+ "exclude": ["node_modules", "dist"]
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index af6e5d2d..9d6c2c36 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
"url": "https://github.com/PanJiaChen/vue-element-admin/issues"
},
"dependencies": {
- "axios": "0.18.0",
+ "axios": "0.18.1",
"clipboard": "2.0.4",
"codemirror": "5.45.0",
"driver.js": "0.9.5",
@@ -77,7 +77,7 @@
"@babel/core": "7.0.0",
"@babel/register": "7.0.0",
"@vue/cli-plugin-babel": "3.5.3",
- "@vue/cli-plugin-eslint": "3.5.1",
+ "@vue/cli-plugin-eslint": "^3.9.1",
"@vue/cli-plugin-unit-jest": "3.5.3",
"@vue/cli-service": "3.5.3",
"@vue/test-utils": "1.0.0-beta.29",
diff --git a/src/components/ImageCropper/index.vue b/src/components/ImageCropper/index.vue
index c2688e99..13ae9a11 100644
--- a/src/components/ImageCropper/index.vue
+++ b/src/components/ImageCropper/index.vue
@@ -6,7 +6,14 @@
-
@@ -108,7 +135,6 @@
-
-
-
diff --git a/src/components/PanThumb/index.vue b/src/components/PanThumb/index.vue
index de6940ad..1bcf4170 100644
--- a/src/components/PanThumb/index.vue
+++ b/src/components/PanThumb/index.vue
@@ -5,7 +5,8 @@
-
+
+
@@ -52,7 +53,8 @@ export default {
.pan-thumb {
width: 100%;
height: 100%;
- background-size: 100%;
+ background-position: center center;
+ background-size: cover;
border-radius: 50%;
overflow: hidden;
position: absolute;
@@ -60,7 +62,7 @@ export default {
transition: all 0.3s ease-in-out;
}
-.pan-thumb:after {
+/* .pan-thumb:after {
content: '';
width: 8px;
height: 8px;
@@ -71,7 +73,7 @@ export default {
margin: -4px 0 0 -4px;
background: radial-gradient(ellipse at center, rgba(14, 14, 14, 1) 0%, rgba(125, 126, 125, 1) 100%);
box-shadow: 0 0 1px rgba(255, 255, 255, 0.9);
-}
+} */
.pan-info {
position: absolute;
diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue
index b07ded2a..9a3318e5 100644
--- a/src/components/SvgIcon/index.vue
+++ b/src/components/SvgIcon/index.vue
@@ -1,7 +1,7 @@
diff --git a/src/filters/index.js b/src/filters/index.js
index f6a28488..98222339 100644
--- a/src/filters/index.js
+++ b/src/filters/index.js
@@ -45,7 +45,7 @@ export function numberFormatter(num, digits) {
]
for (let i = 0; i < si.length; i++) {
if (num >= si[i].value) {
- return (num / si[i].value + 0.1).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol
+ return (num / si[i].value).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol
}
}
return num.toString()
diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue
index 19d3083f..3c20275b 100644
--- a/src/layout/components/TagsView/index.vue
+++ b/src/layout/components/TagsView/index.vue
@@ -9,27 +9,18 @@
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
tag="span"
class="tags-view-item"
- @click.middle.native="closeSelectedTag(tag)"
+ @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''"
@contextmenu.prevent.native="openMenu(tag,$event)"
>
{{ generateTitle(tag.title) }}
-
+
@@ -80,6 +71,9 @@ export default {
isActive(route) {
return route.path === this.$route.path
},
+ isAffix(tag) {
+ return tag.meta && tag.meta.affix
+ },
filterAffixTags(routes, basePath = '/') {
let tags = []
routes.forEach(route => {
@@ -166,7 +160,7 @@ export default {
toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
- this.$router.push(latestView)
+ this.$router.push(latestView.fullPath)
} else {
// now the default is to redirect to the home page if there is no tags-view,
// you can adjust it according to your needs.
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
index 3e2c1703..57e72421 100644
--- a/src/store/modules/tagsView.js
+++ b/src/store/modules/tagsView.js
@@ -28,13 +28,8 @@ const mutations = {
}
},
DEL_CACHED_VIEW: (state, view) => {
- for (const i of state.cachedViews) {
- if (i === view.name) {
- const index = state.cachedViews.indexOf(i)
- state.cachedViews.splice(index, 1)
- break
- }
- }
+ const index = state.cachedViews.indexOf(view.name)
+ index > -1 && state.cachedViews.splice(index, 1)
},
DEL_OTHERS_VISITED_VIEWS: (state, view) => {
@@ -43,12 +38,12 @@ const mutations = {
})
},
DEL_OTHERS_CACHED_VIEWS: (state, view) => {
- for (const i of state.cachedViews) {
- if (i === view.name) {
- const index = state.cachedViews.indexOf(i)
- state.cachedViews = state.cachedViews.slice(index, index + 1)
- break
- }
+ const index = state.cachedViews.indexOf(view.name)
+ if (index > -1) {
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ } else {
+ // if index = -1, there is no cached tags
+ state.cachedViews = []
}
},
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index dbc29003..1391fa4a 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -73,13 +73,18 @@ const actions = {
},
// user logout
- logout({ commit, state }) {
+ logout({ commit, state, dispatch }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
removeToken()
resetRouter()
+
+ // reset visited views and cached views
+ // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
+ dispatch('tagsView/delAllViews', null, { root: true })
+
resolve()
}).catch(error => {
reject(error)
diff --git a/src/utils/clipboard.js b/src/utils/clipboard.js
index e916a44d..cf5b07a1 100644
--- a/src/utils/clipboard.js
+++ b/src/utils/clipboard.js
@@ -22,14 +22,10 @@ export default function handleClipboard(text, event) {
})
clipboard.on('success', () => {
clipboardSuccess()
- clipboard.off('error')
- clipboard.off('success')
clipboard.destroy()
})
clipboard.on('error', () => {
clipboardError()
- clipboard.off('error')
- clipboard.off('success')
clipboard.destroy()
})
clipboard.onClick(event)
diff --git a/src/utils/index.js b/src/utils/index.js
index ffb55260..2684e3c2 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -6,7 +6,7 @@
* Parse the time to string
* @param {(Object|string|number)} time
* @param {string} cFormat
- * @returns {string}
+ * @returns {string | null}
*/
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
@@ -34,14 +34,11 @@ export function parseTime(time, cFormat) {
s: date.getSeconds(),
a: date.getDay()
}
- const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
- let value = formatObj[key]
+ const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
+ const value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
- if (result.length > 0 && value < 10) {
- value = '0' + value
- }
- return value || 0
+ return value.toString().padStart(2, '0')
})
return time_str
}
diff --git a/src/vendor/Export2Excel.js b/src/vendor/Export2Excel.js
index 20784f3a..d8a2af3d 100644
--- a/src/vendor/Export2Excel.js
+++ b/src/vendor/Export2Excel.js
@@ -1,5 +1,5 @@
/* eslint-disable */
-require('script-loader!file-saver');
+import { saveAs } from 'file-saver'
import XLSX from 'xlsx'
function generateArray(table) {
@@ -151,14 +151,14 @@ export function export_json_to_excel({
filename,
merges = [],
autoWidth = true,
- bookType= 'xlsx'
+ bookType = 'xlsx'
} = {}) {
/* original data */
filename = filename || 'excel-list'
data = [...data]
data.unshift(header);
- for (let i = multiHeader.length-1; i > -1; i--) {
+ for (let i = multiHeader.length - 1; i > -1; i--) {
data.unshift(multiHeader[i])
}
diff --git a/src/vendor/Export2Zip.js b/src/vendor/Export2Zip.js
index f776465e..db70707d 100644
--- a/src/vendor/Export2Zip.js
+++ b/src/vendor/Export2Zip.js
@@ -1,5 +1,5 @@
/* eslint-disable */
-require('script-loader!file-saver');
+import { saveAs } from 'file-saver'
import JSZip from 'jszip'
export function export_txt_to_zip(th, jsonData, txtName, zipName) {
diff --git a/src/views/clipboard/index.vue b/src/views/clipboard/index.vue
index e78c6359..4a6bdd1e 100644
--- a/src/views/clipboard/index.vue
+++ b/src/views/clipboard/index.vue
@@ -3,13 +3,13 @@
-
+
copy
-
+
copy
diff --git a/src/views/components-demo/avatar-upload.vue b/src/views/components-demo/avatar-upload.vue
index fae36ad8..5fb6471e 100644
--- a/src/views/components-demo/avatar-upload.vue
+++ b/src/views/components-demo/avatar-upload.vue
@@ -7,7 +7,7 @@
-
+
Change Avatar
diff --git a/src/views/components-demo/mixin.vue b/src/views/components-demo/mixin.vue
index c64a073a..425cf4fb 100644
--- a/src/views/components-demo/mixin.vue
+++ b/src/views/components-demo/mixin.vue
@@ -49,7 +49,7 @@
-
+
标题
diff --git a/src/views/dashboard/admin/components/mixins/resize.js b/src/views/dashboard/admin/components/mixins/resize.js
index bcd17bf0..234953b1 100644
--- a/src/views/dashboard/admin/components/mixins/resize.js
+++ b/src/views/dashboard/admin/components/mixins/resize.js
@@ -3,10 +3,16 @@ import { debounce } from '@/utils'
export default {
data() {
return {
- $_sidebarElm: null
+ $_sidebarElm: null,
+ $_resizeHandler: null
}
},
mounted() {
+ this.$_resizeHandler = debounce(() => {
+ if (this.chart) {
+ this.chart.resize()
+ }
+ }, 100)
this.$_initResizeEvent()
this.$_initSidebarResizeEvent()
},
@@ -27,13 +33,6 @@ export default {
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
- $_resizeHandler() {
- return debounce(() => {
- if (this.chart) {
- this.chart.resize()
- }
- }, 100)()
- },
$_initResizeEvent() {
window.addEventListener('resize', this.$_resizeHandler)
},
diff --git a/src/views/documentation/index.vue b/src/views/documentation/index.vue
index 32f924c3..d68d19d9 100644
--- a/src/views/documentation/index.vue
+++ b/src/views/documentation/index.vue
@@ -4,6 +4,11 @@
{{ $t('documentation.github') }}
国内文档
+ 内推招聘
diff --git a/src/views/excel/export-excel.vue b/src/views/excel/export-excel.vue
index 253f1641..b33ec828 100644
--- a/src/views/excel/export-excel.vue
+++ b/src/views/excel/export-excel.vue
@@ -5,7 +5,7 @@
-
+
{{ $t('excel.export') }} Excel
diff --git a/src/views/excel/merge-header.vue b/src/views/excel/merge-header.vue
index c145932c..2646b9d0 100644
--- a/src/views/excel/merge-header.vue
+++ b/src/views/excel/merge-header.vue
@@ -1,7 +1,7 @@
-
Export
+
Export
-
+
{{ $t('excel.selectedExport') }}
diff --git a/src/views/permission/role.vue b/src/views/permission/role.vue
index 3789e516..3e37a79b 100644
--- a/src/views/permission/role.vue
+++ b/src/views/permission/role.vue
@@ -241,7 +241,7 @@ export default {
dangerouslyUseHTMLString: true,
message: `
Role Key: ${key}
- Role Nmae: ${name}
+ Role Name: ${name}
Description: ${description}
`,
type: 'success'
diff --git a/src/views/tab/index.vue b/src/views/tab/index.vue
index 6438a47a..862a160f 100644
--- a/src/views/tab/index.vue
+++ b/src/views/tab/index.vue
@@ -36,7 +36,7 @@ export default {
}
},
created() {
- // init the default selected tab
+ // init the default selected tab
const tab = this.$route.query.tab
if (tab) {
this.activeName = tab
diff --git a/src/views/table/complex-table.vue b/src/views/table/complex-table.vue
index 43b00e80..51ea42a1 100644
--- a/src/views/table/complex-table.vue
+++ b/src/views/table/complex-table.vue
@@ -35,7 +35,7 @@
style="width: 100%;"
@sort-change="sortChange"
>
-
+
{{ scope.row.id }}
@@ -375,6 +375,14 @@ export default {
return v[j]
}
}))
+ },
+ getSortClass: function(key) {
+ const sort = this.listQuery.sort
+ return sort === `+${key}`
+ ? 'ascending'
+ : sort === `-${key}`
+ ? 'descending'
+ : ''
}
}
}
diff --git a/src/views/zip/index.vue b/src/views/zip/index.vue
index 564d0407..3d1d88ae 100644
--- a/src/views/zip/index.vue
+++ b/src/views/zip/index.vue
@@ -2,7 +2,7 @@
-
+
{{ $t('zip.export') }} Zip
diff --git a/vue.config.js b/vue.config.js
index 085bdc4e..9845cde4 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -7,10 +7,13 @@ function resolve(dir) {
}
const name = defaultSettings.title || 'vue Element Admin' // 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 = 9527 // dev port
+// You can change the port by the following method:
+// port = 9527 npm run dev OR npm run dev --port = 9527
+const port = process.env.port || process.env.npm_config_port || 9527 // dev port
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {