使用严格相等运算符

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 是否已停止变化
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;
}

View File

@@ -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;
}

View File

@@ -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());
}

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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 {