From 50d09574099f39b71ac37739ff7c07ec568f2160 Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 18 Apr 2019 18:16:13 +0800 Subject: [PATCH] perf: optimize some small details --- src/api/user.js | 1 - src/layout/components/Navbar.vue | 4 +++- src/store/getters.js | 1 - src/store/modules/permission.js | 2 +- src/utils/validate.js | 1 + src/views/error-page/404.vue | 23 +++++++---------------- vue.config.js | 2 +- 7 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/api/user.js b/src/api/user.js index a8052005..de69f707 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -22,4 +22,3 @@ export function logout() { method: 'post' }) } - diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index d544f079..51972166 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -36,6 +36,9 @@ {{ $t('navbar.github') }} + + Docs + {{ $t('navbar.logOut') }} @@ -68,7 +71,6 @@ export default { computed: { ...mapGetters([ 'sidebar', - 'name', 'avatar', 'device' ]) diff --git a/src/store/getters.js b/src/store/getters.js index 3fb5b068..313210a0 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -11,7 +11,6 @@ const getters = { introduction: state => state.user.introduction, roles: state => state.user.roles, permission_routes: state => state.permission.routes, - addRoutes: state => state.permission.addRoutes, errorLogs: state => state.errorLog.logs } export default getters diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index bd35252c..aeb5ee53 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -51,7 +51,7 @@ const actions = { return new Promise(resolve => { let accessedRoutes if (roles.includes('admin')) { - accessedRoutes = asyncRoutes + accessedRoutes = asyncRoutes || [] } else { accessedRoutes = filterAsyncRoutes(asyncRoutes, roles) } diff --git a/src/utils/validate.js b/src/utils/validate.js index e04f292e..e81672bb 100644 --- a/src/utils/validate.js +++ b/src/utils/validate.js @@ -1,6 +1,7 @@ /** * Created by jiachenpan on 16/11/18. */ + /** * @param {string} path * @returns {Boolean} diff --git a/src/views/error-page/404.vue b/src/views/error-page/404.vue index 66cb3eae..1791f55a 100644 --- a/src/views/error-page/404.vue +++ b/src/views/error-page/404.vue @@ -8,22 +8,13 @@ 404
-
- OOPS! +
OOPS!
+
All rights reserved + wallstreetcn
-
- 版权所有 - 华尔街见闻 -
-
- {{ message }} -
-
- 请检查您输入的网址是否正确,请点击以下按钮返回主页或者发送错误报告 -
- - 返回首页 - +
{{ message }}
+
Please check that the URL you entered is correct, or click the button below to return to the homepage.
+ Back to home
@@ -35,7 +26,7 @@ export default { name: 'Page404', computed: { message() { - return '网管说这个页面你不能进......' + return 'The webmaster said that you can not enter this page...' } } } diff --git a/vue.config.js b/vue.config.js index bae56d78..7fa00992 100644 --- a/vue.config.js +++ b/vue.config.js @@ -86,7 +86,7 @@ module.exports = { .end() config - // https://webpack.js.org/configuration/devtool/#development + // https://webpack.js.org/configuration/devtool/#development .when(process.env.NODE_ENV === 'development', config => config.devtool('cheap-source-map') )