100% vue masonry without direct dom manipulation, ssr friendly.
npm install vue-masonry-wall* Live Demo: Image and the Source
* Live Demo: Text and the Source

shell script
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 designUsage
`vue
``js
const items = []
const options = {
width: 300,
padding: {
default: 12,
1: 6,
2: 8
}
}const append = () => {
// API call and add items
this.items.push(...[])
}
`$3
`vue
Masonry: append endlessly
{{item.title}}
{{item.content}}
`
$3
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
{{item.title}}
{{item.content}}
``* [ ] nuxt-community/device-module to detect the browser for better SSR support.
* [ ] vue-scrollto to scroll to an item in masonry.
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!