vuejs 前端ui
Vue.js终端UI模拟器 (Vuejs terminal UI emulator)
Vuejs component for displaying UI element that acts as console terminal. Actual terminal logic code forked from Ptty.
Vuejs组件,用于显示充当控制台终端的UI元素。 从Ptty分叉的实际终端逻辑代码。
安装 (Install)
npm i vue-terminal-ui --save
npm i vue-terminal-ui --save
用法 (Usage)
// import plugin
import VueTerminal from 'vue-terminal-ui'
// add to components section
components{
VueTerminal
},
// add method to call on command is typed
methods: {
onCliCommand(data, resolve, reject){
// typed command is available in data.text
// don't forget to resolve or reject the Promise
setTimeout(()=> {
resolve('')
}, 300)
}
},
// use in template
<VueTerminal :intro="intro"
console-sign="$"
allow-arbitrary
height="500px"
@command="onCliCommand"></VueTerminal>
属性和事件 (Properties & Events)
props
道具
intro(String) - intro text when terminal starts;intro(String)-终端启动时的介绍文字;console-sign(String) - starting symbol for each command line, eg.my-folder/master $or just>>;console-sign(字符串)-每个命令行的起始符号,例如my-folder/master $或仅>>;allow-arbitrary(Boolean) - allow type any command in addition to basic ones, then@commandwill be called;allow-arbitrary(Boolean)-允许输入除基本命令以外的任何命令,然后将调用@command;height(String) - UI block height, eg.500px;height(字符串)-UI块的高度,例如500px;
event
事件
@command- callback function to call with command; accepts text, and resolve/reject callbacks@command用命令调用的回调函数; 接受文本,并解决/拒绝回调
去做 (ToDo)
get rid of jQuery dependancy
摆脱jQuery依赖
翻译自: https://vuejsexamples.com/terminal-ui-emulator-vuejs-component/
vuejs 前端ui
1119




被折叠的 条评论
为什么被折叠?



