From 983e635192f708f5616cc62f6f24a3c9012e6119 Mon Sep 17 00:00:00 2001 From: yanglbme Date: Sun, 29 Dec 2019 11:10:53 +0800 Subject: [PATCH] fix: update css2json and fix #7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复页面卡死问题(#7) --- assets/scripts/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/scripts/util.js b/assets/scripts/util.js index fe04fee..2e13831 100644 --- a/assets/scripts/util.js +++ b/assets/scripts/util.js @@ -57,7 +57,7 @@ function css2json(css) { // 初始化返回值 let json = {}; - while (css.length > 0) { + while (css.length > 0 && (css.indexOf('{') !== -1) && (css.indexOf('}') !== -1)) { // 存储第一个左/右花括号的下标 const lbracket = css.indexOf('{'); const rbracket = css.indexOf('}');