<template>
<div class="home hfull">
<ToolsBar :context="context"></ToolsBar>
<WorkSpace ref="workspace" :initFinished="workSpaceInitFinished"></WorkSpace>
</div>
</template>
<script>
export default {
data: () => ({
context:null
}),
methods: {
workSpaceInitFinished(context){
this.context=context
this.context.tempLoad()
if(this.context.tabs.length==0){
this.context.createTab();
}
}
},
created(){
window.isCloseHint = true;
window.addEventListener("beforeunload", function(e) {
if (window.isCloseHint) {
var confirmationMessage = "记得保存!确定要离开吗?";
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
}
});
},
components: {}
};
</script>
<style lang="less">
.home{
display: flex;
flex-direction: column;
}
</style>