You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> It does not have the ability to execute a specific command. This ability needs to be implemented by the developer. What it is responsible for is to get the command to be executed from the user in the form of an interface, and then hand it over to the developer to implement and execute. After that, hand it over to show it to the user
37
+
> It does not have the ability to execute a specific command. This ability needs to be implemented by the developer.
38
+
> What it is responsible for is to get the command to be executed from the user in the form of an interface, and then
39
+
> hand it over to the developer to implement and execute. After that, hand it over to show it to the user
Install vue-web-terminal by npm. The `2.x.x` version corresponds to vue2, and the `3.x.x` version corresponds to vue3. It is recommended to download the latest version corresponding to the main version.
49
+
Install vue-web-terminal by npm. The `2.x.x` version corresponds to vue2, and the `3.x.x` version corresponds to vue3.
50
+
It is recommended to download the latest version corresponding to the main version.
48
51
49
52
```shell
50
53
# install for vue2
@@ -121,10 +124,10 @@ Terminal tag supports attribute parameter table.
| title | The title displayed in the header. | string | vue-web-terminal |
127
-
| show-header | Whether to display the header, this switch will affect the drag and drop function. | boolean | true |
130
+
| 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 |
128
131
| init-log | The log displayed when Terminal is initialized. It is an array composed of [Message](#Message), `null` is not displayed. | array | / |
129
132
| warn-log-count-limit | If the current Terminal log number exceeds this limit, a warning will be issued. Setting a value of `<= 0` will not issue a warning. | number | 200 |
130
133
| auto-help | Whether to enable the command line automatic search prompt function. | boolean | true |
@@ -147,24 +150,24 @@ Terminal tag supports attribute parameter table.
| exec-cmd | Fired when a custom command is executed. `success` and `failed` are callback functions, **must call one of the two callbacks before echoing!**, the meaning of the `success` callback parameter is described below, and the `failed` callback parameter is a string. |`(cmdKey, command, success, failed, name)`|
153
-
| before-exec-cmd | Triggered before the user presses Enter to execute the command. |`(cmdKey, command, name)`|
154
-
| on-keydown | When the cursor focus is obtained, press any keyboard to trigger. |`(event, name)`|
155
-
| on-click | Triggered when the user clicks the button, the parameter `key` is the unique identification of the button, there are buttons: `close`, `minScreen`, `fullScreen`, `title`. |`(key, name)`|
156
-
| init-before | Lifecycle function, triggered before plugin initialization. |`(name)`|
157
-
| init-complete | Lifecycle function, triggered after plugin initialization is complete. |`(name)`|
158
-
| on-active | Triggered when the window is active. |`(name)`|
159
-
| on-inactive | Triggered when the window is inactive. |`(name)`|
| exec-cmd | Fired when a custom command is executed. `success` and `failed` are callback functions, **must call one of the two callbacks before echoing**! the meaning of the `success` callback parameter is described below, and the `failed` callback parameter is a string. |`(cmdKey, command, success, failed, name)`|
156
+
| before-exec-cmd | Triggered before the user presses Enter to execute the command. |`(cmdKey, command, name)`|
157
+
| on-keydown | When the cursor focus is obtained, press any keyboard to trigger. |`(event, name)`|
158
+
| on-click | Triggered when the user clicks the button, the parameter `key` is the unique identification of the button, there are buttons: `close`, `minScreen`, `fullScreen`, `title`. |`(key, name)`|
159
+
| init-before | Lifecycle function, triggered before plugin initialization. |`(name)`|
160
+
| init-complete | Lifecycle function, triggered after plugin initialization is complete. |`(name)`|
161
+
| on-active | Triggered when the window is active. |`(name)`|
162
+
| on-inactive | Triggered when the window is inactive. |`(name)`|
160
163
161
164
**Special note**: The `success` callback parameter of `exec-cmd` supports multiple data types, and the execution logic of different data types will be different:
162
165
163
166
* If no parameters are passed, the execution will end immediately
164
167
* Passing in a [Message](#Message) will append a message to the record and end the execution immediately
165
168
* Pass in a [Message](#Message) array, which will append multiple messages to the record and end the execution immediately
166
-
* Pass in a `Terminal.$Flash` object, it will enter the processing logic of [Real-time-echo(Flash)](#Flash), this execution will not end until `finish()` is called
167
-
* Pass in a `Terminal.$Ask` object, it will enter the processing logic of [user-input](#User-input), this execution will not end until `finish()` is called
169
+
* Pass in a `TerminalFlash` object, it will enter the processing logic of [Real-time-echo(Flash)](#Flash), this execution will not end until `finish()` is called
170
+
* Pass in a `TerminalAsk` object, it will enter the processing logic of [user-input](#User-input), this execution will not end until `finish()` is called
168
171
169
172
> PS:
170
173
>
@@ -192,35 +195,32 @@ Terminal supports the following custom slots, this feature is supported in `2.0.
You can use the api to execute a command to the Terminal, and the execution process will be echoed in the Terminal window. This is a way to use a script to simulate the user executing the command.
320
+
You can use the API to execute a command to the Terminal, and the execution process will be echoed in the Terminal window. This is a way to use a script to simulate the user executing the command.
Get the DOM information of the terminal window. You can use this api to get the terminal's screen width and height, the width and height of the displayed content, the location, the width of a single character, etc. The unit is px.
338
+
Get the DOM information of the terminal window. You can use this API to get the terminal's screen width and height, the width and height of the displayed content, the location, the width of a single character, etc. The unit is px.
339
339
340
340
```js
341
341
let info =TerminalApi.elementInfo('my-terminal')
@@ -793,10 +793,10 @@ asker.ask({
793
793
794
794
#### Use API
795
795
796
-
When you want to edit multi-line text, you can use the API: `textEditorOpen()`, `textEditorClose()`. For details, please refer to the [API](#Api) section. The following is a simple example:
796
+
When you want to edit multi-line text, you can use the API: `textEditorOpen()`, `textEditorClose()`. For details, please refer to the [API](#API) section. The following is a simple example:
797
797
798
798
```js
799
-
TerminalApi.textEditorOpen(this.name, {
799
+
TerminalApi.textEditorOpen('my-terminal', {
800
800
content:'Please edit this file',
801
801
onClose: (value) => {
802
802
console.log("User edit completed, text result:", value)
@@ -817,7 +817,6 @@ If you don't like the default style, you can use Slot to customize the style of
817
817
The plugin provides an `onKeydown` event, which is the best way for you to control the shortcut keys of the Terminal in **active state**, here we take the text editor as an example, set the user to press the shortcut key `Ctrl + S` to indicate Finish editing and save.
I am a Java Coder, and I only know a little bit about the web(js, vue). I developed this plugin because of my interest and work needs.
883
-
When you see the poor source code of this plugin, please understand that.
881
+
I am a back-end Coder, and I only know a little about the front-end. I developed this plug-in because of my personal interest.
884
882
885
883
If you have good ideas for code optimization or functions and are willing to contribute code, please submit [PR](https://github.com/tzfun/vue-web-terminal/pulls),
886
884
If you have any questions about the use of the plugin or find bugs, please submit[issue](https://github.com/tzfun/vue-web-terminal/issues).
@@ -891,6 +889,17 @@ If you have any questions about the use of the plugin or find bugs, please submi
If you have any questions or encounter problems, you can ask them in the communication group, add me to the group on WeChat (see the contact information above)
895
+
896
+
## Donate
897
+
898
+
This plugin is completely open source and free, and it is not easy to create. If you think it is good, you can donate to support this project.
0 commit comments