Press "Enter" to skip to content

Masonry Gallery Layout Component for Vue.js

Masonry Gallery component depends on Vue.js which contains a beautiful layout for the flow of the waterfall and the effect of miniature hills. The component of the selection of openings allows you to interior tabs/external or media width in a conditional popup window.

Compared to other applications, there is no need to determine the display and height of the image in the returned data. A very suitable option for the controlled serial control of the elements or displaying random elements.

vue masonry gallery, masonry layout nuxt, vue js masonry layout, vue masonry css, vue gallery, vue3 masonry, vue 3 gallery, yegervue masonry wall

How to make use of it:

Installation

npm install vue-masonry-gallery --save

Usage

import VueWMasonryGallery from "vue-masonry-gallery";
export default {
  name: "app",
  components: {
    VueMasonryGallery
  }
};
<script src="path/to/vue/vue.js"></script>
<script src="path/to/VueMasonryGallery.js"></script>

Props

propstypedefaultdescription
widthNumberContainer width(px), default is 100% relative to parent element width, Due to the responsiveness, all its parent’s width must be 100% relative to the browser window at this time, See the example after the table
**If it is fixed width, you must set the width prop **, not just its parent element set a fixed width
heightNumber|StringContainer height, the default unit px for the value of the Number type, the unit can be specified when the value is the type of String
When you do not specify the height value, the default is relative to the height of the parent element 100%, then the parent element must have a height
gapNumber20[Pc] space between pictures(px)
mobileGapNumber8[Mobile] space between pictures(px)
imgsArrArray[]required
Data used to render the masonry gallery stream
Each array element is an object and must have src and href attributes.
The src an attribute represents the SRC attribute of the picture
The href an attribute represents the link to click to jump
if your key is not src and href, you can use the two properties of srcKey and hrefKey to do the key-value replacement.
randomBooleanfalseThe function of random display of items. The default option is ‘false’ – to run RANDOM sorting change to ‘true’
srcKeyString‘src’When the key value of your picture address is not src, you can use this property to replace it.
hrefKeyString‘href’When the key value of your picture address is not href, you can use this property to replace it.
targetString‘blank’ ‘self’ ‘modal’A method of running a popup window that displays an image or redirects to an external URL
perPageNumber13The number of items displayed the first time you load the page.
imgWidthNumber330The width of the picture(px)
maxColsNumber5Masonry shows the maximum number of columns
linkRangeString‘card’Identify click to trigger jump link range
value:
‘card’ Whole card range
‘img’ image range
‘custom’ Customize the link range through slots
isRouterLinkBooleanfalseRender the a tag when the value is false
Render the router-link component when the value is true
reachBottomDistanceNumber0The distance(px) from the bottom of the container when the scrolling triggers the scrollReachBottom event
loadingDotCountNumber3The number of default loading animation dots
loadingDotStyleObjectnullThe style object of the small dots in the default loading element
loadingTimeOutNumber500Preloading events less than 500ms milliseconds do not display loading animations, increasing the user experience
cardAnimationClassString‘default-card-animation’the animation className for the card

Event

event namedescription
scrollReachBottomWhen the scroll bar scrolls to the bottom, it is used to trigger a request for new image data
preloadedTrigger every time image preloading is completed
clickTrigger when the card is clicked, look at an example under the table

masonry gallery layout component, vue-masonry-gallery Plugin/Github


See Demo And Download

Official Website(parys-github): Click Here

This superior jQuery/javascript plugin is developed by parys-github. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.