From ed61f3574360998c39bcbe699cd154de47822652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=B4=A4=E6=96=8C?= Date: Wed, 20 Mar 2024 10:23:00 +0800 Subject: [PATCH] Update imgZoom.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复inStr函数的类型问题 --- src/imgZoom.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/imgZoom.js b/src/imgZoom.js index a69e706..bf3db12 100644 --- a/src/imgZoom.js +++ b/src/imgZoom.js @@ -227,10 +227,13 @@ function bing(){ //判断class字符串是否存在imgzoom function inStr(str, string) { var isin = false; - var arr = str.split(' '); - for (var i in arr) { - if (arr[i] == string) { - isin = true; + if (typeof str === "string") { + var arr = str.split(' '); + for (var i in arr) { + if (arr[i] === string) { + isin = true; + break; + } } } return isin; @@ -411,4 +414,4 @@ var imgZoom = function(){ }; }(); -export default imgZoom \ No newline at end of file +export default imgZoom