I am using vue-select component as my dropdowns and giving it :options as the data to put in the dropdown.  I am using it for a credit card dropdown right now and want to add the card type image in in each dropdown row.  Is this possible?
Add <img> tag in dropdown content to insert image into dropdown list for each items. Note: In case the user needs the width of the content to be as wide as the dropdown button, please set the width to 100% (Set overflow: auto to get scroll on small screens).
Get Selected Value of Select Dropdown in VueCreated a select box inside the template syntax. Added an onChange() event handler. Created an options list, cars name primarily. Used the on-change method to grab the selected value using the event object.
You could use the scoped option slot that vue-select provides for creating custom dropdown templates.
Assuming that your options data looked like this:
options: [
  {
    title: "Visa",
    cardImage: "https://codeclimate.com/github/sagalbot/linktoimage.png"
  },
  {
    title: "Mastercard",
    cardImage: "https://codeclimate.com/github/sagalbot/linktoimage.png"
  }
];
Then you could use it as such:
<v-select :options="options" label="title">
  <template slot="option" slot-scope="option">
      <img :src="option.cardImage" />
      {{ option.title }}
  </template>
</v-select>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With