Skip to content

Commit b28e22e

Browse files
committed
[vue3] opt 移除默认的 init-log 内容 tzfun#96
1 parent 2e3ba6d commit b28e22e

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ dist-ssr
3333
/vue-web-terminal.js
3434
stats.html
3535
/docs/
36+
/docs/.vuepress/

src/Terminal.vue

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,7 @@ const props = defineProps({
6363
// 初始化日志内容
6464
initLog: {
6565
type: Array<Message>,
66-
default: (): Array<Message> => {
67-
return [{
68-
type: 'normal',
69-
content: "Terminal Initializing ..."
70-
}, {
71-
type: 'normal',
72-
content: "Current login time: " + new Date().toLocaleString()
73-
}, {
74-
type: 'normal',
75-
content: "Welcome to vue web terminal! If you are using for the first time, you can use the <span class='t-cmd-key'>help</span> command to learn.Thanks for your star support: <a class='t-a' target='_blank' href='https://github.com/tzfun/vue-web-terminal'>https://github.com/tzfun/vue-web-terminal</a>"
76-
}]
77-
}
66+
default: (): Array<Message> => null
7867
},
7968
// 上下文
8069
context: {

test/App.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@
77
import '~/css/theme/dark.css'
88
import {Terminal, TerminalApi, TerminalAsk} from '~/index'
99
import {Command, FailedFunc, Message, SuccessFunc} from "~/types";
10-
import {ref} from "vue";
10+
import {reactive, ref} from "vue";
11+
12+
const initLog = reactive([{
13+
type: 'normal',
14+
content: "Terminal Initializing ..."
15+
}, {
16+
type: 'normal',
17+
content: "Current login time: " + new Date().toLocaleString()
18+
}, {
19+
type: 'normal',
20+
content: "Welcome to vue web terminal! If you are using for the first time, you can use the <span class='t-cmd-key'>help</span> command to learn. Thanks for your star support: <a class='t-a' target='_blank' href='https://github.com/tzfun/vue-web-terminal'>https://github.com/tzfun/vue-web-terminal</a>"
21+
}])
1122
1223
const terminals = ref<any>([
1324
{
@@ -245,15 +256,16 @@ const setCommand = () => {
245256
:drag-conf="item.dragConf"
246257
:show-header="item.showHeader"
247258
:push-message-before="pushMessageBefore"
248-
@exec-cmd="onExecCmd"
249-
@on-active="onActive"
250-
@on-inactive="onInactive"
251259
:log-size-limit="20"
252260
cursor-style="bar"
253261
:cursor-blink="true"
254262
:line-space="15"
255263
enable-hover-stripe
256264
:enable-fold="true"
265+
:init-log="initLog"
266+
@exec-cmd="onExecCmd"
267+
@on-active="onActive"
268+
@on-inactive="onInactive"
257269
style="position: fixed">
258270
<!-- <template #header>-->
259271
<!-- <div class="custom-header">This is custom header</div>-->

0 commit comments

Comments
 (0)