mirror of
https://github.com/potato47/ccc-devtools.git
synced 2024-12-25 11:19:10 +00:00
保存开关状态
This commit is contained in:
parent
272af4381b
commit
02e9fe7b2e
@ -1,4 +1,4 @@
|
||||
# ccc-devtools v1.2.3
|
||||
# ccc-devtools v1.2.4
|
||||
Cocos Creator 网页调试器,运行时查看、修改节点树,实时更新节点属性。
|
||||
|
||||
## TODO
|
||||
|
17
index.html
17
index.html
@ -155,7 +155,7 @@
|
||||
<div id="dev_switch" style="position: absolute;top:45px;left:10px;width: 200px;">
|
||||
<el-switch v-model="isDevMode" @change="handleChangeMode" active-color="#0099ff" inactive-color="gray">
|
||||
</el-switch>
|
||||
<el-tooltip :content="'ccc-devtools@Next v1.2.3'" placement="top">
|
||||
<el-tooltip :content="'ccc-devtools@Next v1.2.4'" placement="top">
|
||||
<Icon type="logo-github" size="24" @click="openGithub" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user