Skip to content

Commit 039cf81

Browse files
committed
publish 3.2.6
1 parent 7b67f36 commit 039cf81

File tree

3 files changed

+76
-36
lines changed

3 files changed

+76
-36
lines changed

README.md

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -82,41 +82,41 @@ Example:
8282
</template>
8383
8484
<script>
85-
import Terminal from "vue-web-terminal"
86-
// This style needs to be introduced in versions after 3.2.0 and 2.1.13.
87-
// There is no need to introduce theme styles in previous versions.
88-
import 'vue-web-terminal/lib/theme/dark.css'
85+
import Terminal from "vue-web-terminal"
86+
// This style needs to be introduced in versions after 3.2.0 and 2.1.13.
87+
// There is no need to introduce theme styles in previous versions.
88+
import 'vue-web-terminal/lib/theme/dark.css'
8989
90-
export default {
91-
name: 'App',
92-
components: {Terminal},
93-
methods: {
94-
onExecCmd(key, command, success, failed) {
95-
if (key === 'fail') {
96-
failed('Something wrong!!!')
97-
} else {
98-
let allClass = ['success', 'error', 'system', 'info', 'warning'];
99-
100-
let clazz = allClass[Math.floor(Math.random() * allClass.length)];
101-
success({
102-
type: 'normal',
103-
class: clazz,
104-
tag: '成功',
105-
content: command
106-
})
90+
export default {
91+
name: 'App',
92+
components: {Terminal},
93+
methods: {
94+
onExecCmd(key, command, success, failed) {
95+
if (key === 'fail') {
96+
failed('Something wrong!!!')
97+
} else {
98+
let allClass = ['success', 'error', 'system', 'info', 'warning'];
99+
100+
let clazz = allClass[Math.floor(Math.random() * allClass.length)];
101+
success({
102+
type: 'normal',
103+
class: clazz,
104+
tag: '成功',
105+
content: command
106+
})
107+
}
107108
}
108109
}
109110
}
110-
}
111111
</script>
112112
113113
<style>
114-
body, html, #app {
115-
margin: 0;
116-
padding: 0;
117-
width: 100%;
118-
height: 100%;
119-
}
114+
body, html, #app {
115+
margin: 0;
116+
padding: 0;
117+
width: 100%;
118+
height: 100%;
119+
}
120120
</style>
121121
```
122122

@@ -164,7 +164,11 @@ Terminal tag supports attribute parameter table.
164164
| push-message-before | A hook function that fires before the push message is displayed. | function | function(message, name) |
165165
| log-size-limit | Limit the maximum number of displayed logs. | number | 200 |
166166
| enable-default-command | Enable default command handler. | boolean | true |
167-
| line-height | Line height, unit px. | number | 20 |
167+
| line-space | Log line height, in `px`. | number | 15 |
168+
| cursor-style | Cursor style, optional values: `block`, `underline`, `bar`, `none` | string | block |
169+
| cursor-blink | Whether to turn on cursor blinking. | boolean | true |
170+
| enable-fold | Whether to enable the log folding function. | boolean | true |
171+
| enable-hover-stripe | Whether the logs in the same group are highlighted when the mouse hovers. | boolean | false |
168172

169173
## Events
170174

@@ -427,6 +431,22 @@ TerminalApi.clearLog('my-terminal')
427431
TerminalApi.clearLog('my-terminal', true)
428432
```
429433

434+
### getCommand()
435+
436+
Get the command currently being entered.
437+
438+
```js
439+
TerminalApi.getCommand('my-terminal')
440+
```
441+
442+
### setCommand()
443+
444+
Set the command currently being entered.
445+
446+
```js
447+
TerminalApi.setCommand('my-terminal', "customCmd -a hello")
448+
```
449+
430450
## Message
431451

432452
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.
@@ -729,8 +749,8 @@ If you set `enable-default-command` to false, these commands will not work;
729749

730750
### Drag
731751

732-
To enable drag and drop, you need to set `show-header` to true and configure `drag-conf`.
733-
You can configure the window size through `width` and `height` of dragConf,
752+
To enable drag and drop, you need to set `show-header` to true and configure `drag-conf`.
753+
You can configure the window size through `width` and `height` of dragConf,
734754
and you can control the window initialization position through `init`, the following is a simple example.
735755

736756
```vue
@@ -838,7 +858,7 @@ asker.ask({
838858

839859
#### Use API
840860

841-
When you want to edit multi-line text, you can use the API: `textEditorOpen()`, `textEditorClose()`.
861+
When you want to edit multi-line text, you can use the API: `textEditorOpen()`, `textEditorClose()`.
842862
For details, please refer to the [API](#API) section. The following is a simple example:
843863

844864
```js
@@ -861,8 +881,8 @@ the parameter is `data`, and data has three attributes that you need to care abo
861881

862882
**Custom Shortcuts**
863883

864-
The plugin provides an `onKeydown` event, which is the best way for you to control the shortcut keys of the Terminal
865-
in **active state**, here we take the text editor as an example, set the user to press the shortcut key `Ctrl + S`
884+
The plugin provides an `onKeydown` event, which is the best way for you to control the shortcut keys of the Terminal
885+
in **active state**, here we take the text editor as an example, set the user to press the shortcut key `Ctrl + S`
866886
to indicate Finish editing and save.
867887

868888
```vue

README_ZH.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ terminal标签支持的属性参数表
160160
| push-message-before | 在推送消息显示之前触发的钩子函数 | function | function(message, name) |
161161
| log-size-limit | 限制显示日志的最大条数 | number | 200 |
162162
| enable-default-command | 控制是否生效默认指令 | boolean | true |
163-
| line-height | 行高,单位px | number | 20 |
163+
| line-space | 日志行高,单位px | number | 15 |
164+
| cursor-style | 光标样式,可选值:`block`, `underline`, `bar`, `none` | string | block |
165+
| cursor-blink | 是否打开光标闪烁 | boolean | true |
166+
| enable-fold | 是否打开日志折叠功能 | boolean | true |
167+
| enable-hover-stripe | 同一组的日志在鼠标hover时是否高亮显示 | boolean | false |
164168

165169
## Events
166170

@@ -423,6 +427,22 @@ TerminalApi.clearLog('my-terminal')
423427
TerminalApi.clearLog('my-terminal', true)
424428
```
425429

430+
### getCommand()
431+
432+
获取当前正在输入的指令
433+
434+
```js
435+
TerminalApi.getCommand('my-terminal')
436+
```
437+
438+
### setCommand()
439+
440+
修改当前正在输入的指令
441+
442+
```js
443+
TerminalApi.setCommand('my-terminal', "customCmd -a hello")
444+
```
445+
426446
## 消息对象
427447

428448
本插件定义了消息对象,任何一个需要被以记录的形式显示在Terminal上的信息都是一个消息对象,`exec-cmd`事件的`success()`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-web-terminal",
3-
"version": "3.2.5",
3+
"version": "3.2.6",
44
"description": "A lightweight and powerful web terminal plugin, suitable for vue3. 轻量、功能强大的网页端Terminal插件,适配vue3",
55
"license": "Apache-2.0",
66
"private": false,

0 commit comments

Comments
 (0)