diff --git a/.eslintrc.js b/.eslintrc.js
index 71a0ffa..3049d24 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -8,18 +8,96 @@ module.exports = {
env: {
node: true,
},
- extends: ['plugin:vue/recommended', '@vue/prettier'],
+ extends: ['plugin:vue/recommended', 'eslint:recommended', '@vue/prettier'],
rules: {
- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
- 'vue/no-v-html': 'off',
- 'vue/multi-word-component-names': 'off',
- 'vue/no-useless-template-attributes': 'off',
+ 'no-undef': 'off',
+ 'no-console': 'off',
+ 'no-debugger': 'off',
+ 'prettier/prettier': 'warn',
+ 'prefer-template': 'error',
+ '@typescript-eslint/no-this-alias': 'off',
+ '@typescript-eslint/no-explicit-any': 'off',
+ '@typescript-eslint/no-var-requires': 'off',
+ '@typescript-eslint/no-empty-function': 'off',
+ '@typescript-eslint/ban-ts-comment': 'off',
'vue/no-reserved-component-names': 'off',
+ 'vue/no-v-html': 'off',
+ 'no-unused-vars': 'off',
+ 'vue/no-useless-template-attributes': 'off',
+ 'use-isnan': 'off',
+ 'vue/html-self-closing': [
+ 'error',
+ {
+ html: {
+ void: 'any',
+ normal: 'any',
+ component: 'always',
+ },
+ svg: 'always',
+ math: 'always',
+ },
+ ],
+ // 多字组件名称
+ 'vue/multi-word-component-names': 'off',
+ // Vue组件排序
+ 'vue/order-in-components': [
+ 'warn',
+ {
+ order: [
+ 'el',
+ 'name',
+ 'key',
+ 'parent',
+ 'functional',
+ ['delimiters', 'comments'],
+ ['components', 'directives', 'filters'],
+ 'extends',
+ 'mixins',
+ ['provide', 'inject'],
+ 'ROUTER_GUARDS',
+ 'layout',
+ 'middleware',
+ 'validate',
+ 'scrollToTop',
+ 'transition',
+ 'loading',
+ 'inheritAttrs',
+ 'model',
+ ['props', 'propsData'],
+ 'emits',
+ 'setup',
+ 'fetch',
+ 'asyncData',
+ 'data',
+ 'head',
+ 'computed',
+ 'watch',
+ 'watchQuery',
+ 'LIFECYCLE_HOOKS',
+ 'methods',
+ ['template', 'render'],
+ 'renderError',
+ ],
+ },
+ ],
+ // Vue属性排序
'vue/attributes-order': [
'warn',
{
- alphabetical: true,
+ order: [
+ 'DEFINITION',
+ 'LIST_RENDERING',
+ 'CONDITIONALS',
+ 'RENDER_MODIFIERS',
+ 'GLOBAL',
+ 'UNIQUE',
+ 'TWO_WAY_BINDING',
+ 'OTHER_DIRECTIVES',
+ 'OTHER_ATTR',
+ 'EVENTS',
+ 'CONTENT',
+ ],
+ alphabetical: true, //字母顺序
},
],
},
diff --git a/package.json b/package.json
index 29fa078..1846401 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "vue-admin-better",
- "version": "2.4.0",
+ "version": "2.5.5",
"author": "vue-admin-better",
"participants": [],
"homepage": "https://chu1204505056.gitee.io/vue-admin-better",
@@ -12,7 +12,7 @@
"lint": "vue-cli-service lint --fix",
"clear": "rimraf node_modules&&npm install --registry=--registry=https://registry.npmmirror.com",
"image-webpack-loader": "cnpm i image-webpack-loader -D",
- "update": "ncu -u --reject prettier,layouts,sass-loader,sass,screenfull,eslint,chalk,vue,vue-template-compiler,vue-router,vuex,@vue/cli-plugin-babel,@vue/cli-plugin-eslint,@vue/cli-service,eslint-plugin-vue --registry=https://registry.npmmirror.com&&cnpm i",
+ "update": "ncu -u --reject eslint-plugin-prettier,@vue/eslint-config-prettier,prettier,layouts,sass-loader,sass,screenfull,eslint,chalk,vue,vue-template-compiler,vue-router,vuex,@vue/cli-plugin-babel,@vue/cli-plugin-eslint,@vue/cli-service,eslint-plugin-vue --registry=https://registry.npmmirror.com&&cnpm i",
"push": "start ./push.sh"
},
"repository": {
@@ -58,13 +58,13 @@
"@vue/cli-plugin-eslint": "^4.5.15",
"@vue/cli-service": "^4.5.15",
"@vue/composition-api": "^1.7.1",
- "@vue/eslint-config-prettier": "^7.1.0",
+ "@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"body-parser": "^1.20.2",
"chalk": "^4.1.2",
"chokidar": "^3.5.3",
"eslint": "^7.32.0",
- "eslint-plugin-prettier": "^5.0.0",
+ "eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-vue": "^9.1.1",
"filemanager-webpack-plugin": "^8.0.0",
"image-webpack-loader": "^8.1.0",
diff --git a/src/components/SelectTree/index.vue b/src/components/SelectTree/index.vue
index 816afbb..db20eed 100644
--- a/src/components/SelectTree/index.vue
+++ b/src/components/SelectTree/index.vue
@@ -24,7 +24,7 @@
:show-checkbox="selectType == 'multiple'"
@check="checkNode"
@node-click="nodeClick"
- >
+ />
@@ -96,7 +96,6 @@
}
},
mounted() {
- const that = this
this.initTree()
},
methods: {
@@ -132,18 +131,18 @@
allNode.forEach((element) => element.classList.remove('is-current'))
},
// select多选时移除某项操作
- removeTag(val) {
+ removeTag() {
this.$refs.treeOption.setCheckedKeys([])
},
// 点击叶子节点
- nodeClick(data, node, el) {
+ nodeClick(data) {
if (data.rank >= this.selectLevel) {
this.selectValue = data.name
this.selectKey = data.id
}
},
// 节点选中操作
- checkNode(data, node, el) {
+ checkNode() {
const checkedNodes = this.$refs.treeOption.getCheckedNodes()
const keyArr = []
const valueArr = []
diff --git a/src/components/VabProfile/index.vue b/src/components/VabProfile/index.vue
index 8517f7f..bfe2fb4 100644
--- a/src/components/VabProfile/index.vue
+++ b/src/components/VabProfile/index.vue
@@ -7,8 +7,10 @@
-
-
{{ username }}
+
+
+ {{ username }}
+
+ />
0 && value < 10) {
- value = '0' + value
+ value = `0${value}`
}
return value || 0
})
@@ -52,7 +52,7 @@ export function parseTime(time, cFormat) {
* @returns {string}
*/
export function formatTime(time, option) {
- if (('' + time).length === 10) {
+ if (`${time}`.length === 10) {
time = parseInt(time) * 1000
} else {
time = +time
@@ -66,26 +66,18 @@ export function formatTime(time, option) {
return '刚刚'
} else if (diff < 3600) {
// less 1 hour
- return Math.ceil(diff / 60) + '分钟前'
+ return `${Math.ceil(diff / 60)}分钟前`
} else if (diff < 3600 * 24) {
- return Math.ceil(diff / 3600) + '小时前'
+ return `${Math.ceil(diff / 3600)}小时前`
} else if (diff < 3600 * 24 * 2) {
return '1天前'
}
if (option) {
return parseTime(time, option)
} else {
- return (
- d.getMonth() +
- 1 +
- '月' +
- d.getDate() +
- '日' +
- d.getHours() +
- '时' +
- d.getMinutes() +
- '分'
- )
+ return `${
+ d.getMonth() + 1
+ }月${d.getDate()}日${d.getHours()}时${d.getMinutes()}分`
}
}
@@ -101,13 +93,11 @@ export function paramObj(url) {
return {}
}
return JSON.parse(
- '{"' +
- decodeURIComponent(search)
- .replace(/"/g, '\\"')
- .replace(/&/g, '","')
- .replace(/=/g, '":"')
- .replace(/\+/g, ' ') +
- '"}'
+ `{"${decodeURIComponent(search)
+ .replace(/"/g, '\\"')
+ .replace(/&/g, '","')
+ .replace(/=/g, '":"')
+ .replace(/\+/g, ' ')}"}`
)
}
@@ -179,16 +169,16 @@ export function tenBitTimestamp(time) {
const date = new Date(time * 1000)
const y = date.getFullYear()
let m = date.getMonth() + 1
- m = m < 10 ? '' + m : m
+ m = m < 10 ? `${m}` : m
let d = date.getDate()
- d = d < 10 ? '' + d : d
+ d = d < 10 ? `${d}` : d
let h = date.getHours()
- h = h < 10 ? '0' + h : h
+ h = h < 10 ? `0${h}` : h
let minute = date.getMinutes()
let second = date.getSeconds()
- minute = minute < 10 ? '0' + minute : minute
- second = second < 10 ? '0' + second : second
- return y + '年' + m + '月' + d + '日 ' + h + ':' + minute + ':' + second //组合
+ minute = minute < 10 ? `0${minute}` : minute
+ second = second < 10 ? `0${second}` : second
+ return `${y}年${m}月${d}日 ${h}:${minute}:${second}` //组合
}
/**
@@ -201,16 +191,16 @@ export function thirteenBitTimestamp(time) {
const date = new Date(time / 1)
const y = date.getFullYear()
let m = date.getMonth() + 1
- m = m < 10 ? '' + m : m
+ m = m < 10 ? `${m}` : m
let d = date.getDate()
- d = d < 10 ? '' + d : d
+ d = d < 10 ? `${d}` : d
let h = date.getHours()
- h = h < 10 ? '0' + h : h
+ h = h < 10 ? `0${h}` : h
let minute = date.getMinutes()
let second = date.getSeconds()
- minute = minute < 10 ? '0' + minute : minute
- second = second < 10 ? '0' + second : second
- return y + '年' + m + '月' + d + '日 ' + h + ':' + minute + ':' + second //组合
+ minute = minute < 10 ? `0${minute}` : minute
+ second = second < 10 ? `0${second}` : second
+ return `${y}年${m}月${d}日 ${h}:${minute}:${second}` //组合
}
/**
diff --git a/src/utils/request.js b/src/utils/request.js
index f359ca6..e2f1524 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -92,8 +92,11 @@ instance.interceptors.response.use(
} else {
handleCode(code, msg)
return Promise.reject(
- 'vue-admin-beautiful请求异常拦截:' +
- JSON.stringify({ url: config.url, code, msg }) || 'Error'
+ `vue-admin-beautiful请求异常拦截:${JSON.stringify({
+ url: config.url,
+ code,
+ msg,
+ })}` || 'Error'
)
}
},
@@ -114,7 +117,7 @@ instance.interceptors.response.use(
}
if (message.includes('Request failed with status code')) {
const code = message.substr(message.length - 3)
- message = '后端接口' + code + '异常'
+ message = `后端接口${code}异常`
}
Vue.prototype.$baseMessage(message || `后端接口未知异常`, 'error')
return Promise.reject(error)
diff --git a/src/utils/vab.js b/src/utils/vab.js
index e594e9a..e88a41b 100644
--- a/src/utils/vab.js
+++ b/src/utils/vab.js
@@ -7,7 +7,7 @@ import { getAccessToken } from '@/utils/accessToken'
const accessToken = store.getters['user/accessToken']
const layout = store.getters['settings/layout']
-const install = (Vue, opts = {}) => {
+const install = (Vue) => {
/* 全局accessToken */
Vue.prototype.$baseAccessToken = () => {
return accessToken || getAccessToken()
@@ -29,7 +29,7 @@ const install = (Vue, opts = {}) => {
loading = Loading.service({
lock: true,
text: text || loadingText,
- spinner: 'vab-loading-type' + index,
+ spinner: `vab-loading-type${index}`,
background: 'hsla(0,0%,100%,.8)',
})
}
@@ -63,7 +63,7 @@ const install = (Vue, opts = {}) => {
loading = Loading.service({
lock: true,
text: text || loadingText,
- spinner: index + '-loader',
+ spinner: `${index}-loader`,
background: 'hsla(0,0%,100%,.8)',
})
}
@@ -86,7 +86,7 @@ const install = (Vue, opts = {}) => {
MessageBox.alert(content, title || '温馨提示', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
- callback: (action) => {
+ callback: () => {
if (callback) {
callback()
}
diff --git a/src/views/401.vue b/src/views/401.vue
index cf070fa..884aa6f 100644
--- a/src/views/401.vue
+++ b/src/views/401.vue
@@ -29,9 +29,15 @@
-
{{ oops }}
-
{{ headline }}
-
{{ info }}
+
+ {{ oops }}
+
+
+ {{ headline }}
+
+
+ {{ info }}
+
{{ jumpTime }}s {{ btn }}
diff --git a/src/views/404.vue b/src/views/404.vue
index 5a28ce0..23b6ec4 100644
--- a/src/views/404.vue
+++ b/src/views/404.vue
@@ -29,9 +29,15 @@
-
{{ oops }}
-
{{ headline }}
-
{{ info }}
+
+ {{ oops }}
+
+
+ {{ headline }}
+
+
+ {{ info }}
+
{{ jumpTime }}s {{ btn }}
diff --git a/src/views/index/components/Plan.vue b/src/views/index/components/Plan.vue
index 253ff54..8e0f8b2 100644
--- a/src/views/index/components/Plan.vue
+++ b/src/views/index/components/Plan.vue
@@ -10,10 +10,7 @@
-
+
diff --git a/src/views/index/index.vue b/src/views/index/index.vue
index 7481bb7..9a65615 100644
--- a/src/views/index/index.vue
+++ b/src/views/index/index.vue
@@ -63,7 +63,7 @@
+ />
{{ item.title }}
@@ -81,7 +81,7 @@
请我们喝杯咖啡,付款后联系qq
783963206,我们将邀请您加入我们的讨论群,谢谢您愿意支持开源,加群获取文档、及基础模板,群内大佬众多,希望能帮到大家(如情况不允许,请勿勉强)。
-
+
QQ讨论群、基础版、文档
@@ -156,10 +156,10 @@
:closable="item.closable"
:title="item.title"
:type="item.type"
- >
+ />
-
+
@@ -180,8 +180,8 @@
-
-
+
+
@@ -560,7 +560,7 @@
handleClick(e) {
this.$baseMessage(`点击了${e.name},这里可以写跳转`)
},
- handleZrClick(e) {},
+ handleZrClick() {},
handleChangeTheme() {
this.$baseEventBus.$emit('theme')
},
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 28e5848..96d2fee 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -5,7 +5,7 @@
style="position: fixed"
title="beautiful boys and girls欢迎加入vue-admin-beautifulQQ群:972435319"
type="success"
- >
+ />
占位符
@@ -50,10 +50,10 @@
class="show-password"
@click="handlePassword"
>
-
+
-
+
-
{{ item.title }}
-
{{ item.description }}
+
+ {{ item.title }}
+
+
+ {{ item.description }}
+
¥ {{ item.price }} 元
@@ -60,7 +64,7 @@
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
- >
+ />
diff --git a/src/views/mall/pay/components/Step1.vue b/src/views/mall/pay/components/Step1.vue
index 096ed07..af85708 100644
--- a/src/views/mall/pay/components/Step1.vue
+++ b/src/views/mall/pay/components/Step1.vue
@@ -5,16 +5,16 @@
请务必仔细填写并核对
-
+
-
+
-
+
-
+
diff --git a/src/views/register/index.vue b/src/views/register/index.vue
index b711398..ac5b3f5 100644
--- a/src/views/register/index.vue
+++ b/src/views/register/index.vue
@@ -6,7 +6,7 @@
style="position: fixed"
title="beautiful boys and girls欢迎加入vue-admin-beautifulQQ群:972435319"
type="success"
- >
+ />
占位符
@@ -28,7 +28,7 @@
style="margin-top: 20px"
type="text"
>
-
+
@@ -40,7 +40,7 @@
show-word-limit
type="text"
>
-
+
@@ -49,10 +49,7 @@
placeholder="手机验证码"
type="text"
>
-
+
-
+
@@ -175,7 +172,7 @@
this.getPhoneIntval = setInterval(() => {
if (n > 0) {
n--
- this.phoneCode = '重新获取(' + n + 's)'
+ this.phoneCode = `重新获取(${n}s)`
} else {
clearInterval(this.getPhoneIntval)
this.getPhoneIntval = null
diff --git a/src/views/vab/element/index.vue b/src/views/vab/element/index.vue
index 670c63f..6acb515 100644
--- a/src/views/vab/element/index.vue
+++ b/src/views/vab/element/index.vue
@@ -45,50 +45,34 @@
文档
-
-
-
-
-
+
+
+
+
+
+ />
+ />
-
-
-
-
-
+ />
+
+
+
+
+
按钮
@@ -117,21 +101,21 @@
信息按钮
警告按钮
危险按钮
-
-
-
-
-
-
+
+
+
+
+
+
默认按钮
主要按钮
成功按钮
信息按钮
警告按钮
危险按钮
-
-
-
+
+
+
搜索
上传
@@ -173,7 +157,7 @@
文档
-
+
页头
-
+
面包屑
-
+
-
-
+
+
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
+
diff --git a/src/views/vab/icon/colorfulIcon.vue b/src/views/vab/icon/colorfulIcon.vue
index 018b442..863d612 100644
--- a/src/views/vab/icon/colorfulIcon.vue
+++ b/src/views/vab/icon/colorfulIcon.vue
@@ -9,7 +9,7 @@
-
+
@@ -41,7 +41,9 @@
:icon-class="`https://fastly.jsdelivr.net/gh/chuzhixin/zx-colorful-icon@master/${item}.svg`"
/>
- {{ item }}
+
+ {{ item }}
+
+ />
diff --git a/src/views/vab/icon/index.vue b/src/views/vab/icon/index.vue
index 4ba9afa..a3ee056 100644
--- a/src/views/vab/icon/index.vue
+++ b/src/views/vab/icon/index.vue
@@ -7,7 +7,7 @@
-
+
@@ -33,7 +33,9 @@
>
- {{ item }}
+
+ {{ item }}
+
+ />
diff --git a/src/views/vab/lodash/index.vue b/src/views/vab/lodash/index.vue
index 3f3e0bb..64ac14b 100644
--- a/src/views/vab/lodash/index.vue
+++ b/src/views/vab/lodash/index.vue
@@ -41,7 +41,9 @@
- 合并数组
+
+ 合并数组
+
this.$baseLodash.concat([1],[2])
@@ -52,7 +54,9 @@
- 左切片
+
+ 左切片
+
this.$baseLodash.drop([1, 2, 3],2切除的数量)
@@ -63,7 +67,9 @@
- 右切片
+
+ 右切片
+
this.$baseLodash.dropRight([1, 2, 3],2切除的数量)
@@ -74,7 +80,9 @@
- 修改拼接
+
+ 修改拼接
+
this.$baseLodash.join(['a', 'b', 'c'], '~');
@@ -85,7 +93,9 @@
- 获取数组最后一个元素
+
+ 获取数组最后一个元素
+
this.$baseLodash.last(['a', 'b', 'c']);
@@ -96,7 +106,9 @@
- 数组去重
+
+ 数组去重
+
this.$baseLodash.uniq(['a', 'b', 'a']);
@@ -107,7 +119,9 @@
- 获取数组的最大值
+
+ 获取数组的最大值
+
this.$baseLodash.max([4, 2, 8, 6])
@@ -118,7 +132,9 @@
- 获取数组的最小值
+
+ 获取数组的最小值
+
this.$baseLodash.min([4, 2, 8, 6])
@@ -142,7 +158,9 @@
- 数组内数据相加
+
+ 数组内数据相加
+
this.$baseLodash.sum([4, 2, 8, 6])
@@ -153,7 +171,9 @@
- 返回随机数
+
+ 返回随机数
+
this.$baseLodash.random(0, 5)
@@ -164,7 +184,9 @@
- 返回数组内的随机数
+
+ 返回数组内的随机数
+
this.$baseLodash.sample([1, 2, 3, 4])
@@ -175,7 +197,9 @@
- 事件防抖动
+
+ 事件防抖动
+
this.$baseLodash.debounce(@click的事件,延迟的毫秒数)
diff --git a/src/views/vab/nested/menu1/menu1-1/menu1-1-1/index.vue b/src/views/vab/nested/menu1/menu1-1/menu1-1-1/index.vue
index bcff7d3..0c83ae3 100644
--- a/src/views/vab/nested/menu1/menu1-1/menu1-1-1/index.vue
+++ b/src/views/vab/nested/menu1/menu1-1/menu1-1-1/index.vue
@@ -1,10 +1,6 @@