I'm trying to combine a string and a prop to create a unique id
for a bootstrap accordion.
I want to combine "collapse" and {{ thread_ref }} to create something like: id="collapse_321"
Vue gives me an error when I try to do this and says to use v-bind.
I have tried that but that only accepts a string of the name of the prop/data, how can I combine a string and data?
Do it like this:
:id="'collape' + thread_ref"
Anything inside the " "
when you bind a property using v-bind
or :
is javascript. So you can do any single line expressions that you do in JavaScript
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