Here is a way you could do it using CSS variables:
const MyInput = {
template: `
<input
class="my-input"
placeholder="Placeholder"
:style="placeholderColor ? {'--placeholder-color': placeholderColor} : {}"
>
`,
props: ['placeholder-color']
}
new Vue({
el: '#app',
components: {
MyInput
},
data () {
return {
colors: ['#f00', '#0f0', '#00f']
}
},
methods: {
rotate () {
this.colors.push(this.colors.shift())
}
}
})
.my-input {
--placeholder-color: #f0f;
}
.my-input::placeholder {
color: var(--placeholder-color);
}
<script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
<div id="app">
<my-input v-for="color in colors" :placeholder-color="color"></my-input>
<br>
<button @click="rotate">Rotate</button>
<br>
<my-input></my-input>
</div>
The trick is that a CSS variable can be set using style
even though a pseudo-element cannot be styled directly.