Vue
by ujjumaki
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-vue/2.15.0/bootstrap-vue.min.js"></script>
<div id="app">
<h2>Input Fields:</h2>
<div v-for="(todo,index) in todos" :key="index">
<b-form-input type="text" v-model="todo.datatype" :value="todo.id" placeholder="Insert Datatype" v-on:input="moveToNextField($event)"></b-form-input>
<!-- If the input field 1, consists more than 5 characters. Automatically move on to second field -->
<!-- And when the input field 2 contains more than 5 characters. Move on to third field -->
<br>
</div>
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 8px 0;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
Vue
new Vue({
el: "#app",
data: {
todos: [
{ id: "1", datatype: ""},
{ id: "2", datatype: ""},
{ id: "3", datatype: ""}
]
},
methods: {
toggle: function(todo){
todo.done = !todo.done
},
moveToNextField(event){
if(this.todos[0].datatype.length > 5)
{
console.log("field 1");
}
if(this.todos[1].datatype.length > 5)
{
console.log("field 2");
}
}
}
})