[Vuejs]-How can I make the placeholder of a button dynamic in Vue?

1👍

You can make the placeholder dynamic by passing a prop to your component and then setting the placeholder to the value of the prop.
Like so:

<SDSelectBox :placeHolder="someValueFromCurrentComponent"></SDSelectBox>
//Inside the SDSelectBox
<template>
  <select>
   <option value="" disabled selected>{{placeholder}}</option>
...
props: ['placeHolder'],

Or with a slot you can simply insert into the SDSelectBox:

<select>
 <slot></slot>
...
//parent component
<SDSelectBox>
 <option value="" disabled selected>{{placeholder}}</option>
</SDSelectBox>

Leave a comment