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; + } } });