<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"/>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script>
</head>
<body>
<div id="app">
<main2></main2>
</div>
<script>
Vue.component('main2', {
name : 'MainBarber',
data(){
return {
categorias : []
}
},
mounted(){
this.getCategorias();
},
methods : {
getCategorias(){
console.log("categorias");
this.categorias = [
{id : 1, nombre : 'Esportivo', descripcion : 'desc1'},
{id : 2, nombre : 'Infos', descripcion : 'desc2'},
{id : 3, nombre : 'Politica', descripcion : 'desc3'},
{id : 4, nombre : 'Moda', descripcion : 'desc4'},
{id : 5, nombre : 'Cocina', descripcion : 'desc5'},
{id : 6, nombre : 'Casa', descripcion : 'desc6'}
];
}
},
template: `<div class="row">
<categoria-card v-for="cate in categorias"
:categoria=cate :key="cate.id">{{cate.id}}
</categoria-card>
</div>`
})
Vue.component('categoria-card', {
name : 'categoria-card',
props : ['categoria'],
template: `<div class="col-4">
<div class="card card-image" >
<div class="text-center justify-content-center rgba-black-strong py-5 px-4 rounded">
<div>
<h6 class="purple-text">
<i class="fa fa-pie-chart"></i>
<strong>Categoria</strong>
</h6>
<h3 class="py-3 font-weight-bold">
<strong>{{ categoria.nombre }}</strong>
</h3>
<p class="pb-3 text-center">{{ categoria.descripcion }} </p>
<a class="btn btn-success btn-rounded btn-md waves-effect waves-light"><i class="fa fa-clone left"></i>Ver Servicios</a>
</div>
</div>
</div>
</div>`
})
new Vue({
el: '#app',
data: {
message: 'Hello Vue.js!'
}
})
</script>
</body>
</html>