使用严格相等运算符

This commit is contained in:
2021-07-05 23:15:24 +08:00
parent 7b76fc0c48
commit d8f48d4ce0
6 changed files with 22 additions and 22 deletions

View File

@@ -70,7 +70,7 @@ let utils = {
// 检测 currentIndex 是否已停止变化 // 检测 currentIndex 是否已停止变化
var timer = setInterval(() => { var timer = setInterval(() => {
if (currentIndexCpy == currentIndex) { if (currentIndexCpy === currentIndex) {
// 停止检测 // 停止检测
clearInterval(timer); clearInterval(timer);
@@ -109,7 +109,7 @@ let utils = {
var datasCache = {}; var datasCache = {};
var datasCurrent = {}; var datasCurrent = {};
if (mode == 'R') { if (mode === 'R') {
// 读取缓存 // 读取缓存
datasCacheStr = localStorage.getItem('navLinksCache'); 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 { return {
status: 0 status: 0
}; };
@@ -142,7 +142,7 @@ let utils = {
}; };
} }
} else if (mode == 'W') { } else if (mode === 'W') {
datasCurrent.version = datas.version; datasCurrent.version = datas.version;
datasCurrent.list = list; datasCurrent.list = list;
@@ -179,7 +179,7 @@ let utils = {
let cache = utils.cache('R'); let cache = utils.cache('R');
// 缓存可以使用 // 缓存可以使用
if (cache.status == 1) { if (cache.status === 1) {
datas.list = cache.list; datas.list = cache.list;
return; return;
} }

View File

@@ -42,10 +42,10 @@ export default {
return style; return style;
} }
if (this.from == 'inner') { if (this.from === 'inner') {
// 内部 // 内部
iconPath = require(`@/assets/icon/${this.path}`); iconPath = require(`@/assets/icon/${this.path}`);
} else if (this.from == 'outer') { } else if (this.from === 'outer') {
// 外部 // 外部
iconPath = this.path; iconPath = this.path;
} }

View File

@@ -60,9 +60,9 @@ export default {
info: { info: {
strLength: 8, strLength: 8,
option: { option: {
caseSensitive: false, caseSensitive: true,
hasNum: false, hasNum: true,
hasChar: false, hasChar: true,
hasSymbol: false, hasSymbol: false,
lowerCase: false lowerCase: false
}, },
@@ -98,7 +98,7 @@ export default {
genRandomStr(strLength, hasNum, hasChar, hasSymbol, caseSensitive, lowerCase) { genRandomStr(strLength, hasNum, hasChar, hasSymbol, caseSensitive, lowerCase) {
var result = '请选中数字、字母或其他符号的其中一项!'; var result = '请选中数字、字母或其他符号的其中一项!';
if (hasNum == false && hasChar == false && hasSymbol == false) { if (hasNum === false && hasChar === false && hasSymbol === false) {
return result; return result;
} }
@@ -107,15 +107,15 @@ export default {
for (var i = strLength; i > 0; i--) { for (var i = strLength; i > 0; i--) {
let num = Math.floor((Math.random() * 94) + 33); let num = Math.floor((Math.random() * 94) + 33);
let flag = (( let flag = ((
(hasNum == false) && ((num >= 48) && (num <= 57)) (hasNum === false) && ((num >= 48) && (num <= 57))
) || ( ) || (
(hasChar == false) && (( (hasChar === false) && ((
(num >= 65) && (num <= 90) (num >= 65) && (num <= 90)
) || ( ) || (
(num >= 97) && (num <= 122) (num >= 97) && (num <= 122)
)) ))
) || ( ) || (
(hasSymbol == false) && (( (hasSymbol === false) && ((
(num >= 33) && (num <= 47) (num >= 33) && (num <= 47)
) || ( ) || (
(num >= 58) && (num <= 64) (num >= 58) && (num <= 64)
@@ -146,7 +146,7 @@ export default {
result += String.fromCharCode(num); result += String.fromCharCode(num);
} }
if (caseSensitive == false) { if (caseSensitive === false) {
result = (lowerCase ? result.toLocaleLowerCase() : result.toUpperCase()); result = (lowerCase ? result.toLocaleLowerCase() : result.toUpperCase());
} }

View File

@@ -270,12 +270,12 @@ export default {
* 更改当前显示的分类 * 更改当前显示的分类
*/ */
changeCategory(index) { changeCategory(index) {
if (index == 'search') { if (index === 'search') {
this.currentLinks = []; this.currentLinks = [];
this.show.searchEngine = true; this.show.searchEngine = true;
this.show.searchLink = false; this.show.searchLink = false;
this.show.linkTree = false; this.show.linkTree = false;
} else if (index == 'all') { } else if (index === 'all') {
this.currentLinks = this.navLinks.list; this.currentLinks = this.navLinks.list;
this.show.searchEngine = false; this.show.searchEngine = false;
this.show.searchLink = true; this.show.searchLink = true;
@@ -344,7 +344,7 @@ export default {
var keyword = search.keyword; var keyword = search.keyword;
var url = ''; var url = '';
if (keyword == '') { if (keyword === '') {
return false; return false;
} else { } else {
keyword = window.encodeURIComponent(keyword); keyword = window.encodeURIComponent(keyword);
@@ -354,7 +354,7 @@ export default {
let list = search.list[category].list; let list = search.list[category].list;
for (let index in list) { for (let index in list) {
if (list[index].name == selected) { if (list[index].name === selected) {
url = list[index].url.replace(/%keyword%/, keyword); url = list[index].url.replace(/%keyword%/, keyword);
break; break;
} }

View File

@@ -72,9 +72,9 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
if (type == 'cache') { if (type === 'cache') {
localStorage.removeItem('navLinksCache'); localStorage.removeItem('navLinksCache');
} else if (type == 'settings') { } else if (type === 'settings') {
localStorage.removeItem('navConfig'); localStorage.removeItem('navConfig');
} else { } else {
return return

View File

@@ -54,7 +54,7 @@ export default {
var route = vm.$route; var route = vm.$route;
// 判断进入的路由 // 判断进入的路由
if (route.name == 'ToolsDetail') { if (route.name === 'ToolsDetail') {
// 进入:工具内容页面 // 进入:工具内容页面
vm.detailOpen(route.params.category, route.params.name); vm.detailOpen(route.params.category, route.params.name);
} else { } else {