LoongPanel-Asp/web/components/Term.vue

46 lines
894 B
Vue

<script lang="ts" setup>
import {useMainLayoutStore} from "~/strores/UseMainLayoutStore";
const mainLayoutStore = useMainLayoutStore()
const path = ref<string>('')
onBeforeMount(() => {
$fetch('/Api/Server/GetServerTerminalPath', {
method: 'GET',
params: {
ServerId: mainLayoutStore.SelectServer.id,
},
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${useCookie('token').value}`
},
baseURL: useRuntimeConfig().public.baseUrl
}).then((res: any) => {
path.value = res
})
})
</script>
<template>
<div id="terminal">
<iframe :src="path"></iframe>
</div>
</template>
<style lang="scss" scoped>
@import "base";
#terminal {
min-width: 60vw;
min-height: 60vh;
padding: $padding;
background: #000;
border-radius: $radius*2;
iframe {
width: 100%;
height: 60vh;
border: none;
}
}
</style>