From 02e9fe7b2edd6c0e813affd6ae3f35279e0bd37c Mon Sep 17 00:00:00 2001 From: Next <1406099478@qq.com> Date: Fri, 28 Dec 2018 20:48:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=BC=80=E5=85=B3=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- index.html | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bf27292..26a7abd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ccc-devtools v1.2.3 +# ccc-devtools v1.2.4 Cocos Creator 网页调试器,运行时查看、修改节点树,实时更新节点属性。 ## TODO diff --git a/index.html b/index.html index 8ae2b7a..2496353 100644 --- a/index.html +++ b/index.html @@ -155,7 +155,7 @@
- +
@@ -230,11 +230,8 @@ let initWin = () => { if (window.cc) { let top = document.getElementById('top') - // top.insertBefore(document.getElementsByClassName('toolbar')[0], top.firstChild); top.appendChild(document.getElementsByClassName('toolbar')[0]); document.getElementById('game_panel').appendChild(document.getElementById('content')); - // let content = document.getElementById('content'); - // content.insertBefore(document.getElementById('searchInput'), content.firstChild); let scene = cc.director.getScene(); if (scene) { this.$data.sceneTreeData = scene.children; @@ -250,11 +247,12 @@ }, this); clearInterval(this.$data.intervalId); } else { - console.log('cc is not init'); + // console.log('cc is not init'); } } this.$data.intervalId = setInterval(initWin, 500); setTimeout(initWin, 0); + localStorage.setItem('isDevMode', 1); }, closeDevMode() { this.$data.node = null; @@ -263,6 +261,7 @@ clearInterval(this.$data.intervalId); document.body.appendChild(document.getElementsByClassName('toolbar')[0]); document.body.appendChild(document.getElementById('content')); + localStorage.setItem('isDevMode', 0); }, handleChangeMode(data) { data ? this.openDevMode() : this.closeDevMode(); @@ -274,9 +273,13 @@ } }, created: function () { - let toolbar = document.getElementsByClassName('toolbar')[0]; - // toolbar.insertBefore(document.getElementById('dev_switch'), toolbar.firstChild); document.body.insertBefore(document.getElementById('app'), document.body.firstChild); + if (localStorage.getItem('isDevMode') === "1") { + this.$data.isDevMode = true; + this.openDevMode(); + } else { + this.$data.isDevMode = false; + } } });