mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
delete useless code
This commit is contained in:
1 parent
b66baa2070
commit
211b4e08e8
1 file changed
+2
-30
@@ -5,20 +5,14 @@
|
|||||||
id="terminal"
|
id="terminal"
|
||||||
ref="terminal"
|
ref="terminal"
|
||||||
class="bg-background-secondary h-[calc(100%-5%)] p-0.5"
|
class="bg-background-secondary h-[calc(100%-5%)] p-0.5"
|
||||||
>
|
></div>
|
||||||
<!-- <p class="text-text-primary">
|
|
||||||
zeko@first-command<span class="text-text">:~$</span>
|
|
||||||
</p> -->
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Terminal } from 'xterm'
|
import { Terminal } from 'xterm'
|
||||||
import { FitAddon } from 'xterm-addon-fit'
|
import { FitAddon } from 'xterm-addon-fit'
|
||||||
import { AttachAddon } from 'xterm-addon-attach'
|
// import { AttachAddon } from 'xterm-addon-attach'
|
||||||
import 'xterm/css/xterm.css'
|
import 'xterm/css/xterm.css'
|
||||||
import { io } from 'socket.io-client'
|
import { io } from 'socket.io-client'
|
||||||
// import connect from 'server/src/client'
|
|
||||||
|
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
|
|
||||||
const rows = ref(40)
|
const rows = ref(40)
|
||||||
@@ -66,34 +60,12 @@ onMounted(() => {
|
|||||||
term.onData((key) => {
|
term.onData((key) => {
|
||||||
console.log(key)
|
console.log(key)
|
||||||
socket.send(key)
|
socket.send(key)
|
||||||
if (key.length > 1) term.write(key)
|
|
||||||
if (key == '\r') {
|
|
||||||
// term.write('\n')
|
|
||||||
term.write('\r\n\x1b[33mLinux Odyssey$\x1b[0m ')
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
term.open(terminal.value)
|
term.open(terminal.value)
|
||||||
const fitAddon = new FitAddon()
|
const fitAddon = new FitAddon()
|
||||||
term.loadAddon(fitAddon)
|
term.loadAddon(fitAddon)
|
||||||
fitAddon.fit()
|
fitAddon.fit()
|
||||||
term.writeln('Welcome to \x1b[1;32mLinux Odyssey\x1b[0m!')
|
term.writeln('Welcome to \x1b[1;32mLinux Odyssey\x1b[0m!')
|
||||||
term.onKey((e) => {
|
|
||||||
const printable =
|
|
||||||
!e.domEvent.altKey &&
|
|
||||||
!e.domEvent.altGraphKey &&
|
|
||||||
!e.domEvent.ctrlKey &&
|
|
||||||
!e.domEvent.metaKeys
|
|
||||||
if (e.domEvent.keyCode === 8) {
|
|
||||||
// back 删除的情况
|
|
||||||
if (term.xcore.buffer.x > 2) {
|
|
||||||
term.write('\b \b')
|
|
||||||
}
|
|
||||||
} else if (printable) {
|
|
||||||
term.write(e.key)
|
|
||||||
}
|
|
||||||
console.log(1, 'print', e.key)
|
|
||||||
})
|
|
||||||
|
|
||||||
function resizeScreen() {
|
function resizeScreen() {
|
||||||
try {
|
try {
|
||||||
// 窗口大小改变时,触发xterm的resize方法使自适应
|
// 窗口大小改变时,触发xterm的resize方法使自适应
|
||||||
|
|||||||
Reference in new issue
Block a user