I have some vue.js components, all these components get their data from outside.
Example:
<vue-button icon="fa-arrow-right" text="mytext"></vue-button>
This works great so far but now I have to set multiple values over the property.
This does not work:
<vue-list items="['Entry1', 'Entry2']"></vue-list>
How can I set multiple values over one property?
Update
I have a working example but I am not sure if thats the right way to go but it works. If someone knows a better way I would be happy if you share it with me/us.
This is how I call the component:
<vue-list times='[ "08:00 - 12:00", "13:00 - 21:00" ]'></vue-list>
And this is the code of the component:
<template>
<div>
<div v-for="item in timesArray">
<span v-html="item"></span>
</div>
</div>
</template>
<script>
export default {
props: ['times'],
data: function() {
return {
timesArray: [],
}
},
created: function() {
this.timesArray = JSON.parse(this.times);
}
}
</script>