All Projects → fuxingloh → Vue Masonry Wall

fuxingloh / Vue Masonry Wall

Licence: mit
A pure vue responsive masonry layout without direct dom manipulation and ssr support.

Projects that are alternatives of or similar to Vue Masonry Wall

Veluxi Starter
Veluxi Vue.js Starter Project with Nuxt JS and Vuetify
Stars: ✭ 39 (-50.63%)
Mutual labels:  nuxt, nuxtjs, ssr
Virapro.ru
[E-commerce] Plumbing Store
Stars: ✭ 45 (-43.04%)
Mutual labels:  nuxt, nuxtjs, ssr
awrora-starter
Landing page template built with one of most popular javascript library Vue.JS, Vuetify (Material Design) and Nuxt.JS with SSR.
Stars: ✭ 38 (-51.9%)
Mutual labels:  ssr, nuxt, nuxtjs
Sails Nuxt
Sails + Nuxt + Vuetify Combo <3
Stars: ✭ 92 (+16.46%)
Mutual labels:  nuxt, nuxtjs, ssr
Wemake Vue Template
Bleeding edge vue template focused on code quality and developer happiness.
Stars: ✭ 645 (+716.46%)
Mutual labels:  nuxt, nuxtjs, ssr
laravel-nuxt
Laravel 5.6 + Nuxt 1.4: Auth Starter (SSR, SPA, Socialite)
Stars: ✭ 19 (-75.95%)
Mutual labels:  ssr, nuxt, nuxtjs
Nuxt Ssr Firebase
Nuxt.js Universal App with SSR via Firebase Functions and Firebase Hosting
Stars: ✭ 273 (+245.57%)
Mutual labels:  nuxt, nuxtjs, ssr
Surmon.me
🆒 My personal website and blog, powered by @vuejs (3)
Stars: ✭ 1,767 (+2136.71%)
Mutual labels:  nuxt, nuxtjs, ssr
Sitemap Module
Sitemap Module for Nuxt
Stars: ✭ 539 (+582.28%)
Mutual labels:  nuxt, nuxtjs, ssr
Nuxt Firebase Sns Example
Nuxt v2 & Firebase(Hosting / Functions SSR / Firestore), Google Auth SNS Example.
Stars: ✭ 485 (+513.92%)
Mutual labels:  nuxt, nuxtjs, ssr
jooger.me
👍 My personal website,powered by @nuxt
Stars: ✭ 39 (-50.63%)
Mutual labels:  ssr, nuxt, nuxtjs
Nuxt Static Render
Nuxt module for SSR without rehydration payload
Stars: ✭ 32 (-59.49%)
Mutual labels:  nuxt, nuxtjs, ssr
Blog Front
blog-front @nuxt
Stars: ✭ 305 (+286.08%)
Mutual labels:  nuxt, nuxtjs, ssr
Vuecnodejs
⚽️🎉Vue初/中级项目,CnodeJS社区重构。( a junior project of Vue.js, rewrite cnodejs.org ) 预览(DEMO):
Stars: ✭ 705 (+792.41%)
Mutual labels:  nuxt, nuxtjs, ssr
Laravel Vuejs.com
Laravel and VueJs Blog, using Laravel nova, GraphQL, NuxtJs, Apollo and ...more
Stars: ✭ 54 (-31.65%)
Mutual labels:  nuxt, nuxtjs, ssr
Axios Module
Secure and easy axios integration with Nuxt.js
Stars: ✭ 998 (+1163.29%)
Mutual labels:  nuxt, ssr
Iblog
基于 Node.js 的开源个人博客系统,采用 Nuxt + Vue + TypeScript 技术栈。
Stars: ✭ 994 (+1158.23%)
Mutual labels:  nuxt, nuxtjs
Nuxt Tailwind
A Nuxt.js starter project template using Tailwind CSS without the distraction of a complicated development environment.
Stars: ✭ 71 (-10.13%)
Mutual labels:  nuxt, nuxtjs
Quickjam
Starter template for Nuxt apps bundled with an API
Stars: ✭ 42 (-46.84%)
Mutual labels:  nuxt, nuxtjs
Nuxt Template
🗃 Nuxt Template (Typescript + Composition API)
Stars: ✭ 40 (-49.37%)
Mutual labels:  nuxt, nuxtjs

vue-masonry-wall

A pure vue responsive masonry implementation without direct dom manipulation, ssr friendly with lazy appending. I created this because other libraries has no SSR support, and I needed a pure vue implementation.

vue-masonry-wall screenshot

Installation

npm i vue-masonry-wall
# or yarn
yarn add vue-masonry-wall

Features

  • No Direct DOM Manipulation
  • SSR friendly, able to load and re hydrate later
  • 1 dependency only, no legacy dependencies
  • Auto lazy appending, scroll to auto load more
  • Auto item placement, will find best column
  • Responsive design

Usage

<vue-masonry-wall :items="items" :options="options" @append="append"/>
const items = []
const options = {
  width: 300,
  padding: {
    default: 12,
    1: 6,
    2: 8
  }
}

const append = () => {
  // API call and add items
  this.items.push(...[])
}

Basic

<template>
  <div id="app">
    <h2>Masonry: append endlessly</h2>

    <vue-masonry-wall :items="items" :options="{width: 300, padding: 12}" @append="append">
      <template v-slot:default="{item}">
        <div class="item">
          <h5>{{item.title}}</h5>
          <p>{{item.content}}</p>
        </div>
      </template>
    </vue-masonry-wall>
  </div>
</template>

<script>
  import VueMasonryWall from "vue-masonry-wall";

  export default {
    name: 'app',
    components: {VueMasonryWall},
    data() {
      return {
        items: [
          {title: 'Item 0', content: 'Content'},
          {title: 'Item 1', content: 'Content'},
        ]
      }
    },
    methods: {
      /**
       * I am mocking a API call that load 20 objects at a time.
       */
      append() {
        for (let i = 0; i < 20; i++) {
          this.items.push({title: `Item ${this.items.length}`, content: 'Content'})
        }
      }
    }
  }
</script>

Nuxt SSR

Add :ssr="{columns: 2}" to masonry so that during SSR, it will be load in 2 columns.

SSR has no clue what is the size of your height of your element or width of the browser. You can however guess based on user-agent: https://github.com/nuxt-community/device-module This param allow you to preload a config for SSR rendering, it will distribute your items into all columns evenly.

<vue-masonry-wall :items="items" :options="{width: 300, padding: 12}" :ssr="{columns: 2}" @append="append">
  <template v-slot:default="{item}">
    <div class="item">
      <h5>{{item.title}}</h5>
      <p>{{item.content}}</p>
    </div>
  </template>
</vue-masonry-wall>

Dependencies

Contributing

For any question or feature request please feel free to create an issue or pull request.

TODO

These were features from my original project that I removed for brevity of this package.

Vue Horizontal

I also maintain another project called Vue Horizontal.

At its core, Vue Horizontal is an ultra simple pure vue horizontal layout for modern responsive web with zero dependencies. Vue Horizontal is also an ultra complex code snippet dossier with over 100 SPA/SSR/SSG friendly recipes for your design needs. Do check it out, might be useful for you!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].