Commit 9c9d501d authored by Le Dinh Trung's avatar Le Dinh Trung

add banners

parent 333e6b86
...@@ -107,15 +107,17 @@ export default { ...@@ -107,15 +107,17 @@ export default {
icon: 'mdi-newspaper', icon: 'mdi-newspaper',
title: 'Posts', title: 'Posts',
to: '/posts' to: '/posts'
},
{
icon: ' mdi-image-marker-outline',
title: 'Banners',
to: '/banners'
} }
], ],
miniVariant: false, miniVariant: false,
title: 'Homepage' title: 'Homepage'
} }
}, },
mounted () {
console.log('123')
},
methods: { methods: {
async logout () { async logout () {
try { try {
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
show-arrows-on-hover show-arrows-on-hover
> >
<v-carousel-item <v-carousel-item
v-for="(slide, i) in slides" v-for="(item, index) in banners"
:key="i" :key="index"
:src="img[i]" :src="item.image"
> >
<v-row <v-row
class="fill-height" class="fill-height"
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
justify="center" justify="center"
> >
<div class="text-h2"> <div class="text-h2">
{{ slide }} Slide {{ index +1 }}
</div> </div>
</v-row> </v-row>
</v-carousel-item> </v-carousel-item>
...@@ -28,15 +28,37 @@ export default { ...@@ -28,15 +28,37 @@ export default {
name: 'PageCarousels', name: 'PageCarousels',
data () { data () {
return { return {
img: [ bannerss: [
'https://d-themes.com/html/riode/images/demos/demo1/slides/slide1.jpg', { src: 'https://d-themes.com/html/riode/images/demos/demo1/slides/slide1.jpg', ordering: 0 },
'https://d-themes.com/html/riode/images/demos/demo1/slides/slide2.jpg' { src: 'https://d-themes.com/html/riode/images/demos/demo1/slides/slide2.jpg', ordering: 1 }
], ],
banners: [],
slides: [ slides: [
'First', 'First',
'Second' 'Second'
] ]
} }
},
mounted () {
this.getBanners()
},
methods: {
async getBanners () {
await this.$axios
.get('guest/banners/get-active-banners', {
headers: {
Authorization: `Bearer ${this.$auth.$storage.getUniversal(
'token'
)}`
}
})
.then((response) => {
this.banners = response.data.data
})
.catch(function (error) {
console.log(error)
})
}
} }
} }
</script> </script>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment