I'm developing a console with HTML5 + Vue to streamline some simple commands.
The inserted command comes via a textarea with v-model="cmd" v-on:keyup.enter="consoleMode()"
.
I'm using else else, since I only need 4 functions.
consoleMode: function(cmd){
this.cmdHistory.push({command: this.cmd})
if(this.cmd == 'cls\n'){
this.cmdHistory = [{command: 'início'}]
} else if(this.cmd == 'add client\n'){
this.cmdQuest = 'Qual o nome do cliente?'
//ler a primeira resposta e fazer outras perguntas
} else if(this.cmd == 'exit\n'){
this.cmdQuest = ''
}
this.cmd = ''
}
I caught the first question, because I have no idea how I can capture some values in the scanf
style in C with this textarea.
newClient
object, alternating the value of this.cmdQuest
for each new line ("What's the name? "," What is the CPF? ", Etc.).
If there is any plugin to help with this, it would be cool.
EDIT1: this.cmdHistory
is an array with objects type {command: 'my last command'}
link