-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
i added this package as plugin in Nuxtjs. I follow documentation but i not get desire result
this is what i get
this is what is want
Plugin -
import Vue from 'vue'
import VueJustifiedLayout from 'vue-justified-layout'
Vue.use(VueJustifiedLayout)
nuxt config
plugins: [
{ src: '@/plugins/gallery.js', ssr: false }
],
main File Where i used it
<template>
<div>
<VueJustifiedLayout :items="images">
<template slot-scope="{ item }">
<nuxt-link :to="{name:'slug', params:{slug:item.slug}}">
<img
:src="item.thumb"
:alt="item.name"
loading="lazy"
>
</nuxt-link>
</template>
</VueJustifiedLayout>
<infinite-loading spinner="spiral" @infinite="infiniteHandler">
<div slot="no-more">Come Back Again 😉</div>
</infinite-loading>
</div>
</template>
<style scoped>
.justified-container {}
.justified-item {
img {
max-width: 100%;
}
}
</style>
<script>
export default {
data(){
return {
url:"/get-images",
page:1,
images:[],
}
},
mounted() {
},
methods:{
infiniteHandler($state) {
this.$axios.$get(this.url, {
params: {
page: this.page,
},
}).then(({ data }) => {
if (data.length) {
this.page += 1;
this.images.push(...data);
$state.loaded();
} else {
$state.complete();
}
});
},
}
};
</script>
Nuxtjs Version
"nuxt": "^2.14.0",
Metadata
Metadata
Assignees
Labels
No labels

