Skip to content

Commit 881dff1

Browse files
committed
[vue2] publish 2.1.14
1 parent 5a5df74 commit 881dff1

File tree

4 files changed

+76
-65
lines changed

4 files changed

+76
-65
lines changed

README.md

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,20 @@ Use Terminal plugin in `main.js`
6161

6262
```js
6363
import Terminal from 'vue-web-terminal'
64-
// This style needs to be introduced in versions after 3.1.8 and 2.1.12.
64+
// This style needs to be introduced in versions after 3.2.0 and 2.1.13.
6565
// There is no need to introduce theme styles in previous versions.
6666
import 'vue-web-terminal/lib/theme/dark.css'
6767

6868
// for vue2
6969
Vue.use(Terminal)
7070

7171
// for vue3
72-
const app = createApp(App)
73-
app.use(Terminal)
72+
const app = createApp(App).use(Terminal)
7473
```
7574

7675
Example:
7776

7877
```vue
79-
8078
<template>
8179
<div id="app">
8280
<terminal name="my-terminal" @exec-cmd="onExecCmd"></terminal>
@@ -85,7 +83,7 @@ Example:
8583
8684
<script>
8785
import Terminal from "vue-web-terminal"
88-
// This style needs to be introduced in versions after 3.1.8 and 2.1.12.
86+
// This style needs to be introduced in versions after 3.2.0 and 2.1.13.
8987
// There is no need to introduce theme styles in previous versions.
9088
import 'vue-web-terminal/lib/theme/dark.css'
9189
@@ -145,26 +143,27 @@ If you need to customize the theme, you can customize the corresponding css vari
145143

146144
Terminal tag supports attribute parameter table.
147145

148-
| Argument | Description | Type | Default |
149-
|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|--------------------------------------------------|
150-
| name | Terminal instance name, the name of the same vue instance must be unique, this value is also used in API. | string | terminal |
151-
| context | Context text. | string | /vue-web-terminal |
152-
| context-suffix | Context text suffix. | string | \> |
153-
| title | The title displayed in the header. | string | vue-web-terminal |
154-
| show-header | Whether to display the header, this switch will affect the drag and [drop](#Drag) function. Only when the header is displayed can the drag and drop function provided by default be used. | boolean | true |
155-
| init-log | The log displayed when Terminal is initialized. It is an array composed of [Message](#Message), `null` is not displayed. | array | / |
156-
| auto-help | Whether to enable the command line automatic search prompt function. | boolean | true |
157-
| enable-example-hint | Whether to show sample prompts, provided that `auto-help` is enabled. | boolean | true |
158-
| command-store | Customized command library, the search prompt function will scan this library, see [Command Definition](#Command) | array | [Local Commands](#Local) |
159-
| command-store-sort | Command line library sorting function, the display collation of the custom command library. | function | function(a,b) |
160-
| input-filter | Custom input filter, the return value is the filtered string, must be plain text, no html tags. | function | function(当前输入字符char, 输入框内字符串value, input事件event) |
161-
| drag-conf | Drag and drop window configuration items. **If you do not configure it, the parent element will be filled with 100%, and the window width and height are equal to the width and height of the parent element.** | object | [Drag](#Drag) |
162-
| command-formatter | Command display formatting function, pass in the current command and return a new command, support html. If not set, the internally defined highlight style will be used. | function | function(cmd) |
163-
| tab-key-handler | The logic processing method when the user types the Tab key can be used in conjunction with the `helpCmd` slot. | function | function(event) |
164-
| search-handler | User-defined command search prompt implementation, the callback needs to resolve a command object, the specific format see [Command Definition format](#Command), can be used with `helpCmd` this slot | function | function(commandStore, key, callback) |
165-
| scroll-mode | Scroll bar mode. | string | smooth |
166-
| push-message-before | A hook function that fires before the push message is displayed. | function | function(message, name) |
167-
| log-size-limit | Limit the maximum number of displayed logs | number | 200 |
146+
| Argument | Description | Type | Default |
147+
|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|--------------------------------------------------|
148+
| name | Terminal instance name, the name of the same vue instance must be unique, this value is also used in API. | string | terminal |
149+
| context | Context text. | string | /vue-web-terminal |
150+
| context-suffix | Context text suffix. | string | \> |
151+
| title | The title displayed in the header. | string | vue-web-terminal |
152+
| show-header | Whether to display the header, this switch will affect the drag and [drop](#Drag) function. Only when the header is displayed can the drag and drop function provided by default be used. | boolean | true |
153+
| init-log | The log displayed when Terminal is initialized. It is an array composed of [Message](#Message), `null` is not displayed. | array | / |
154+
| auto-help | Whether to enable the command line automatic search prompt function. | boolean | true |
155+
| enable-example-hint | Whether to show sample prompts, provided that `auto-help` is enabled. | boolean | true |
156+
| command-store | Customized command library, the search prompt function will scan this library, see [Command Definition](#Command) | array | [Local Commands](#Local) |
157+
| command-store-sort | Command line library sorting function, the display collation of the custom command library. | function | function(a,b) |
158+
| input-filter | Custom input filter, the return value is the filtered string, must be plain text, no html tags. | function | function(当前输入字符char, 输入框内字符串value, input事件event) |
159+
| drag-conf | Drag and drop window configuration items. **If you do not configure it, the parent element will be filled with 100%, and the window width and height are equal to the width and height of the parent element.** | object | [Drag](#Drag) |
160+
| command-formatter | Command display formatting function, pass in the current command and return a new command, support html. If not set, the internally defined highlight style will be used. | function | function(cmd) |
161+
| tab-key-handler | The logic processing method when the user types the Tab key can be used in conjunction with the `helpCmd` slot. | function | function(event, rewriteCallback(newCmd)) |
162+
| search-handler | User-defined command search prompt implementation, the callback needs to resolve a command object, the specific format see [Command Definition format](#Command), can be used with `helpCmd` this slot | function | function(commandStore, key, callback) |
163+
| scroll-mode | Scroll bar mode. | string | smooth |
164+
| push-message-before | A hook function that fires before the push message is displayed. | function | function(message, name) |
165+
| log-size-limit | Limit the maximum number of displayed logs. | number | 200 |
166+
| enable-default-command | Enable default command handler. | boolean | true |
168167

169168
> Below are the removed properties
170169
>
@@ -432,6 +431,18 @@ TerminalApi.textEditorClose('my-terminal', true)
432431
TerminalApi.textEditorClose('my-terminal', false)
433432
```
434433

434+
### clearLog()
435+
436+
Clear the contents of the current screen, or clear history log.
437+
438+
```js
439+
// clear screen log
440+
TerminalApi.clearLog('my-terminal')
441+
442+
// clear history log
443+
TerminalApi.clearLog('my-terminal', true)
444+
```
445+
435446
## Message
436447

437448
This plugin defines a message object. Any information that needs to be displayed on the Terminal in the form of a record is a message object. It is used by the `success()` callback of the `exec-cmd` event and the `pushMessage` api.

0 commit comments

Comments
 (0)