vue-tags-input icon indicating copy to clipboard operation
vue-tags-input copied to clipboard

dropdown returns the entire tag object --need to show only tag content

Open campgurus opened this issue 5 years ago • 2 comments

I am using this package with a tag input, pulling the list of tags from an external api and everything is working well, except this issue.

I can't figure out how to use the array of tag objects with { :id, :tag } but in the drop down show only the :tag.

here is the component:


              <vue-tags-input
                v-model="tag"
                v-on:keyup.native="getTags"
                :tags="tags"
                :autocomplete-items="filteredItems"
                :autocomplete-min-length=3
                @tags-changed="confirmedTags"
              />

and filteredItems returns an array of Tag objects.

campgurus avatar May 29 '20 19:05 campgurus

This is what the current drop down looks like: Screen Shot 2020-05-29 at 3 35 03 PM

campgurus avatar May 29 '20 19:05 campgurus

@campgurus you either have to override the template

      <template #tag-left="{tag}">
        <div v-if="tag.tagScope">
          {{ tag.tagScope.tagScopeName }}
        </div>
      </template>

or create a computed property / function that maps the text you want to display to the "text" property

 return tags.map(t => {
        t.text = t.tagName;
}};

ryansorensen avatar Sep 21 '20 19:09 ryansorensen