Skip to content

v1.1.0

Compare
Choose a tag to compare
@shentao shentao released this 08 Aug 21:47
· 539 commits to master since this release

New:

#77 Introduce support for custom option’s template.

Example from the README:

Using Vue’s partial API

multiselect(
  :options="styleList",
  :selected="selectedStyle",
  :option-height="130",
  :custom-label="styleLabel",
  @update="updateSelectedStyle",
  option-partial="customOptionPartial"
  placeholder="Fav No Man’s Sky path"
  label="title"
  key="title"
)
import customOptionPartial from './partials/customOptionPartial.html'
Vue.partial('customOptionPartial', customOptionPartial)

// ...Inside Vue component
methods: {
  styleLabel ({ title, desc }) {
    return `${title}${desc}`
  },
  updateSelectedStyle (style) {
    this.selectedStyle = style
  }
}
<div>
  <img class="option__image" :src="option.img" alt="No Man’s Sky" />
  <div class="option__desc">
    <span class="option__title">{{ option.title }}</span>
    <span class="option__small">
      {{ option.desc }}
    </span>
  </div>
</div>