I want what is in the colors array (hex codes for now) to display in the template <color-block> that I have created.
Vue.component('color-block', {
props: ['hexcolor'],
template:
`
<div class="col-lg-1 col-md-4 col-sm-6 col-xs-12"
{{ colors.hex }}
</div>
`
});
new Vue({
el: '#app',
data: {
colors: [
{ color: 'Red', hex: '#FF0000' },
{ color: 'Blue', hex: '#0000FF' }
]
}
})
<script src="https://unpkg.com/[email protected]"></script>
<div id="app">
<color-block v-for="hex in colors" :colorBlock="hex">
</color-block>
</div>