Publishing TagInput component to npm

Marcos Neves
vuejs-tips
Published in
1 min readMar 20, 2017

#8 Wrapping TagInput component using the template from last tip

This is the repository and this is the code that matters

https://github.com/vuejs-tips/v-tag-input/blob/master/src/Component.vue

Lines 21 and 24 are where the magic happens. The input array is converted to string and bound to the input, and the input string is converted back to array before $emit it.

Demo 1

Demo 2

You can link in you own project using one of those urls:

  1. https://rawgit.com/vuejs-tips/v-tag-input/master/dist/v-tag-input.js
  2. https://unpkg.com/v-tag-input
  3. Or yarn add v-tag-input

The final component has only 1KB (gziped). Pretty lite for a tag input, hum?

--

--

Marcos Neves
vuejs-tips

Ancient Brazilian web developer, from php, through Rails to Javascript, Vue.js enthusiast to React.