vue-web-terminalvue-web-terminal
Home
  • Get Started
  • Theme
  • Attribute
  • Event
  • Slot
  • API
  • Advanced Features
  • More
About
Q&A
  • GitHub
  • Gitee 码云
  • English
  • 中文简体
Home
  • Get Started
  • Theme
  • Attribute
  • Event
  • Slot
  • API
  • Advanced Features
  • More
About
Q&A
  • GitHub
  • Gitee 码云
  • English
  • 中文简体
  • About
  • Document

    • Get Started
    • Theme
    • Attribute
    • Event
      • exec-cmd
      • before-exec-cmd
      • on-keydown
      • on-click
      • init-before
      • init-complete
      • on-active
      • on-inactive
    • Slot
    • API
    • Advanced Features
    • More
  • Q&A

Events

exec-cmd

  • Parameters: (commandKey, command, success, failed, name)
    • commandKey: string, command key.
    • command: string, the complete command line entered by the user.
    • success: (message?: Message | Array<Message> | string | TerminalFlash | TerminalAsk) => void; , success callback function.
    • failed: (message: string) => void;, failure callback function.
    • name: string, the name of the Terminal instance.
  • Description: This event is triggered when a custom command is executed. After this event is triggered, one of the success or failed callbacks must be called to consider the execution completed, otherwise the command input line will not be echoed.

Tips

The success callback parameter supports multiple data types, and the execution logic of different data types will be different:

  • Without passing any parameters, the execution ends immediately.
  • Passing a message object Message will append a message to the log and immediately terminate the execution.
  • Passing an array of message objects Message[] will append multiple messages to the log and immediately terminate the execution.
  • Passing a TerminalFlash object will enter the real-time echo processing logic. This execution will not end until finish() is called.
  • Passing a TerminalAsk object will enter the user query input processing logic. This execution will not end until finish() is called.

before-exec-cmd

  • Parameters: (commandKey, command, name)
    • commandKey: string, command key.
    • command: string, the complete command line entered by the user.
    • name: string, the name of the Terminal instance.
  • Description: Triggered after the user presses Enter, before the command is actually executed.

on-keydown

  • Parameters: (event, name)
    • event: KeyboardEvent, native keyboard events.
    • name: string, the name of the Terminal instance.
  • Description: Triggered when any key is pressed while obtaining the command input cursor focus.

on-click

  • Parameters: (key, name)
    • key: string, button name.
    • name: string, the name of the Terminal instance.
  • Description: Triggered when the user clicks a button. The parameter key is the unique identifier of the button. Here are some existing buttons: close | minScreen | fullScreen | title | pin

init-before

  • Parameters: (name)
  • Description: Lifecycle function, triggered before the plugin is initialized.

init-complete

  • Parameters: (name)
  • Description: Lifecycle function, triggered after the plugin is initialized.

on-active

  • Parameters: (name)
  • Description: Triggered when the window becomes active.

on-inactive

  • Parameters: (name)
  • Description: Triggered when the window changes from active to inactive.
Edit this page on GitHub
Last Updated:
Contributors: tzfun
Prev
Attribute
Next
Slot