[Vuejs]-Make a input field like multi select option

0👍

You should do something like:

<template>
<span>{{ labels }}</span><input type="text" v-model="labelString" @keyup.188="addLabels">
</template>

new Vue({
  el: "#app",
  data() {
        return {
            labelString: '',
            labels: []
        }
    },
    methods: {
        addLabels() {
            this.labels.push(this.labelString);
            this.labelString = '';
        },
    }
})

Sample

And then then style the span with labels to make it look as it’s located “inside” input.

Leave a comment