|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div @click="focusInput()" class="console">
|
|
|
|
|
<div @keypress.enter="displayCommand()" class="group" v-for="(group, index) in history" :key="group">
|
|
|
|
|
<div @click="focusInput()" class="console" ref="console">
|
|
|
|
|
<div class="content">
|
|
|
|
|
<div @keypress.enter="displayCommand();" class="group" v-for="(group, index) in history" :key="group">
|
|
|
|
|
<pre><span class="host">{{group.host}}</span><span
|
|
|
|
|
v-if="index !== history.length-1">{{group.command}}</span><input
|
|
|
|
|
v-else v-model="group.command" ref="consoleInput" type="text" autocomplete="off"></pre>
|
|
|
|
|
<pre><span v-for="output in group.output" :key="output" :class="output.color">{{output.content}}</span></pre>
|
|
|
|
|
<pre v-if="group.output.length"><span v-for="output in group.output" :key="output" :class="output.color">{{output.content}}</span></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
@ -37,17 +39,19 @@ export default {
|
|
|
|
|
command: "",
|
|
|
|
|
output: []
|
|
|
|
|
});
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
this.focusInput()
|
|
|
|
|
this.$forceUpdate();
|
|
|
|
|
this.focusInput();
|
|
|
|
|
this.scrollToBottom();
|
|
|
|
|
}
|
|
|
|
|
window.scrollTo(0,document.body.scrollHeight);
|
|
|
|
|
this.scrollToBottom();
|
|
|
|
|
}, group.delay)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
focusInput(){
|
|
|
|
|
this.$nextTick(function lol(){
|
|
|
|
|
this.$refs.consoleInput.focus();
|
|
|
|
|
})
|
|
|
|
|
this.$nextTick(() => this.$refs.consoleInput.focus());
|
|
|
|
|
},
|
|
|
|
|
scrollToBottom(){
|
|
|
|
|
this.$nextTick(() => this.$refs.console.scrollTop = this.$refs.console.scrollHeight);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
@ -63,9 +67,13 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
.console{
|
|
|
|
|
color: #fff;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
.content{
|
|
|
|
|
height: fit-content;
|
|
|
|
|
margin: 1rem;
|
|
|
|
|
.group{
|
|
|
|
|
.host{color: #02a594;}
|
|
|
|
|
.white{color: #fff}
|
|
|
|
|
.white{color: #fff;}
|
|
|
|
|
.green{color: #44dd88;}
|
|
|
|
|
.blue{color: #0081b1;}
|
|
|
|
|
input{
|
|
|
|
@ -80,4 +88,5 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|