From f4f125d06c0aaa7e4f31d379fda7ac346f744813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Wed, 10 Jun 2020 19:03:48 +0800 Subject: [PATCH] perf: fixed lint --- src/components/ImageCropper/index.vue | 1 + src/store/modules/settings.js | 1 + src/store/modules/user.js | 29 +++++++++++---------------- src/views/excel/merge-header.vue | 28 +++++++++++++------------- 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/src/components/ImageCropper/index.vue b/src/components/ImageCropper/index.vue index 13ae9a11..65a4262b 100644 --- a/src/components/ImageCropper/index.vue +++ b/src/components/ImageCropper/index.vue @@ -248,6 +248,7 @@ export default { // 浏览器是否支持该控件 isSupported, // 浏览器是否支持触屏事件 + // eslint-disable-next-line no-prototype-builtins isSupportTouch: document.hasOwnProperty('ontouchstart'), // 步骤 step: 1, // 1选择文件 2剪裁 3上传 diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index e389af79..110533f7 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -13,6 +13,7 @@ const state = { const mutations = { CHANGE_SETTING: (state, { key, value }) => { + // eslint-disable-next-line no-prototype-builtins if (state.hasOwnProperty(key)) { state[key] = value } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 1391fa4a..78009412 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -103,28 +103,23 @@ const actions = { }, // dynamically modify permissions - changeRoles({ commit, dispatch }, role) { - return new Promise(async resolve => { - const token = role + '-token' + async changeRoles({ commit, dispatch }, role) { + const token = role + '-token' - commit('SET_TOKEN', token) - setToken(token) + commit('SET_TOKEN', token) + setToken(token) - const { roles } = await dispatch('getInfo') + const { roles } = await dispatch('getInfo') - resetRouter() + resetRouter() - // generate accessible routes map based on roles - const accessRoutes = await dispatch('permission/generateRoutes', roles, { root: true }) + // generate accessible routes map based on roles + const accessRoutes = await dispatch('permission/generateRoutes', roles, { root: true }) + // dynamically add accessible routes + router.addRoutes(accessRoutes) - // dynamically add accessible routes - router.addRoutes(accessRoutes) - - // reset visited views and cached views - dispatch('tagsView/delAllViews', null, { root: true }) - - resolve() - }) + // reset visited views and cached views + dispatch('tagsView/delAllViews', null, { root: true }) } } diff --git a/src/views/excel/merge-header.vue b/src/views/excel/merge-header.vue index 2646b9d0..4be0227d 100644 --- a/src/views/excel/merge-header.vue +++ b/src/views/excel/merge-header.vue @@ -71,21 +71,21 @@ export default { }, handleDownload() { this.downloadLoading = true - import('@/vendor/Export2Excel').then(excel => { - const multiHeader = [['Id', 'Main Information', '', '', 'Date']] - const header = ['', 'Title', 'Author', 'Readings', ''] - const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'] - const list = this.list - const data = this.formatJson(filterVal, list) - const merges = ['A1:A2', 'B1:D1', 'E1:E2'] - excel.export_json_to_excel({ - multiHeader, - header, - merges, - data - }) - this.downloadLoading = false + import('@/vendor/Export2Excel').then(excel => { + const multiHeader = [['Id', 'Main Information', '', '', 'Date']] + const header = ['', 'Title', 'Author', 'Readings', ''] + const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time'] + const list = this.list + const data = this.formatJson(filterVal, list) + const merges = ['A1:A2', 'B1:D1', 'E1:E2'] + excel.export_json_to_excel({ + multiHeader, + header, + merges, + data }) + this.downloadLoading = false + }) }, formatJson(filterVal, jsonData) { return jsonData.map(v => filterVal.map(j => {