How to display dynamic placeholder text of <v-text-field> in Vuetify?

Viewed 6786

The text field is somewhat like this:

<v-text-field v-model="input" placeholder="(0 - 200)">
</v-text-field>

Vue.js data contains:

export default {
data () {
    return {
        input: '',
        proposed: 0  
        }
    }
}

I'd like the placeholder to display something like this:

placeholder="Proposed quantity: 2 (0 - 200)"

Tried setting the proposed variable with e.g.:

a) placeholder="Proposed quantity: {proposed} (0 - 200)"
b) placeholder="Proposed quantity: `${proposed}` (0 - 200)"
c) placeholder="Proposed quantity: " + proposed + " (0 - 200)"

and none worked.

Any other ideas and suggestions?

1 Answers

You have to bind the placeholder to your data object using : or v-bind:placeholder ... like :

  :placeholder="'Proposed quantity: '+proposed+ ' (0 - 200)'"

or

  v-bind:placeholder="'Proposed quantity: '+proposed+ ' (0 - 200)'"
Related