Search code examples
htmlvue.jsjscolor

Vue.js value bind with prefix and suffix


I tried binding a value to an input using a variable that has been declared in the data object, but I also need to add a prefix and a suffix

<input id="topnavback", v-bind:value="rgb({{themestopnavback}})", class="jscolor"/>

The value themetopnavback is the value defined in data and I want to put the rgb with bracktes around it.

But this always causes the whole page not to render the DOM which only occurs if you try to access a Vue variable which isn't existing in the data object. Is this just wrong or isn't it possible to bind a value with additional strings?

Thanks in advance


Solution

  • v-bind:value="'rgb(' + themestopnavback + ')'"