From d8f48d4ce09f516da1ef2aa72d2e1c9bcffe2f58 Mon Sep 17 00:00:00 2001 From: Frost-ZX <30585462+Frost-ZX@users.noreply.github.com> Date: Mon, 5 Jul 2021 23:15:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E4=B8=A5=E6=A0=BC=E7=9B=B8?= =?UTF-8?q?=E7=AD=89=E8=BF=90=E7=AE=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/js/navLinks.js | 10 +++++----- src/components/Icon.vue | 4 ++-- src/components/tools/GenRandomStr.vue | 16 ++++++++-------- src/views/Home.vue | 8 ++++---- src/views/Settings.vue | 4 ++-- src/views/Tools.vue | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/assets/js/navLinks.js b/src/assets/js/navLinks.js index 43634d5..c8733f2 100644 --- a/src/assets/js/navLinks.js +++ b/src/assets/js/navLinks.js @@ -70,7 +70,7 @@ let utils = { // 检测 currentIndex 是否已停止变化 var timer = setInterval(() => { - if (currentIndexCpy == currentIndex) { + if (currentIndexCpy === currentIndex) { // 停止检测 clearInterval(timer); @@ -109,7 +109,7 @@ let utils = { var datasCache = {}; var datasCurrent = {}; - if (mode == 'R') { + if (mode === 'R') { // 读取缓存 datasCacheStr = localStorage.getItem('navLinksCache'); @@ -124,7 +124,7 @@ let utils = { } // 链接数据为空 - if (datasCache.list === undefined || datasCache.list.length == 0) { + if (datasCache.list === undefined || datasCache.list.length === 0) { return { status: 0 }; @@ -142,7 +142,7 @@ let utils = { }; } - } else if (mode == 'W') { + } else if (mode === 'W') { datasCurrent.version = datas.version; datasCurrent.list = list; @@ -179,7 +179,7 @@ let utils = { let cache = utils.cache('R'); // 缓存可以使用 - if (cache.status == 1) { + if (cache.status === 1) { datas.list = cache.list; return; } diff --git a/src/components/Icon.vue b/src/components/Icon.vue index a4d16c3..d921ebf 100644 --- a/src/components/Icon.vue +++ b/src/components/Icon.vue @@ -42,10 +42,10 @@ export default { return style; } - if (this.from == 'inner') { + if (this.from === 'inner') { // 内部 iconPath = require(`@/assets/icon/${this.path}`); - } else if (this.from == 'outer') { + } else if (this.from === 'outer') { // 外部 iconPath = this.path; } diff --git a/src/components/tools/GenRandomStr.vue b/src/components/tools/GenRandomStr.vue index 5737b21..372e452 100644 --- a/src/components/tools/GenRandomStr.vue +++ b/src/components/tools/GenRandomStr.vue @@ -60,9 +60,9 @@ export default { info: { strLength: 8, option: { - caseSensitive: false, - hasNum: false, - hasChar: false, + caseSensitive: true, + hasNum: true, + hasChar: true, hasSymbol: false, lowerCase: false }, @@ -98,7 +98,7 @@ export default { genRandomStr(strLength, hasNum, hasChar, hasSymbol, caseSensitive, lowerCase) { var result = '请选中数字、字母或其他符号的其中一项!'; - if (hasNum == false && hasChar == false && hasSymbol == false) { + if (hasNum === false && hasChar === false && hasSymbol === false) { return result; } @@ -107,15 +107,15 @@ export default { for (var i = strLength; i > 0; i--) { let num = Math.floor((Math.random() * 94) + 33); let flag = (( - (hasNum == false) && ((num >= 48) && (num <= 57)) + (hasNum === false) && ((num >= 48) && (num <= 57)) ) || ( - (hasChar == false) && (( + (hasChar === false) && (( (num >= 65) && (num <= 90) ) || ( (num >= 97) && (num <= 122) )) ) || ( - (hasSymbol == false) && (( + (hasSymbol === false) && (( (num >= 33) && (num <= 47) ) || ( (num >= 58) && (num <= 64) @@ -146,7 +146,7 @@ export default { result += String.fromCharCode(num); } - if (caseSensitive == false) { + if (caseSensitive === false) { result = (lowerCase ? result.toLocaleLowerCase() : result.toUpperCase()); } diff --git a/src/views/Home.vue b/src/views/Home.vue index 3e3f9b5..44e65dc 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -270,12 +270,12 @@ export default { * 更改当前显示的分类 */ changeCategory(index) { - if (index == 'search') { + if (index === 'search') { this.currentLinks = []; this.show.searchEngine = true; this.show.searchLink = false; this.show.linkTree = false; - } else if (index == 'all') { + } else if (index === 'all') { this.currentLinks = this.navLinks.list; this.show.searchEngine = false; this.show.searchLink = true; @@ -344,7 +344,7 @@ export default { var keyword = search.keyword; var url = ''; - if (keyword == '') { + if (keyword === '') { return false; } else { keyword = window.encodeURIComponent(keyword); @@ -354,7 +354,7 @@ export default { let list = search.list[category].list; for (let index in list) { - if (list[index].name == selected) { + if (list[index].name === selected) { url = list[index].url.replace(/%keyword%/, keyword); break; } diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 5ad51db..9c2d20f 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -72,9 +72,9 @@ export default { type: 'warning' }).then(() => { - if (type == 'cache') { + if (type === 'cache') { localStorage.removeItem('navLinksCache'); - } else if (type == 'settings') { + } else if (type === 'settings') { localStorage.removeItem('navConfig'); } else { return diff --git a/src/views/Tools.vue b/src/views/Tools.vue index e0bad4b..71751a5 100644 --- a/src/views/Tools.vue +++ b/src/views/Tools.vue @@ -54,7 +54,7 @@ export default { var route = vm.$route; // 判断进入的路由 - if (route.name == 'ToolsDetail') { + if (route.name === 'ToolsDetail') { // 进入:工具内容页面 vm.detailOpen(route.params.category, route.params.name); } else {