Skip to content

Mashed Everything #8

@thetestcoder

Description

@thetestcoder

i added this package as plugin in Nuxtjs. I follow documentation but i not get desire result

this is what i get

Screenshot_2020-09-28 Quotster

this is what is want

Screenshot_2020-09-27 Freepik Graphic Resources for everyone

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions