W
W
wlms2019-02-27 22:24:37
Vue.js
wlms, 2019-02-27 22:24:37

How to fix vue-masonry errors?

Connected in main.js like this:

import Vue from 'vue'
import {VueMasonryPlugin} from 'vue-masonry'

Zayuzal like this:
Vue.use(VueMasonryPlugin)
In jade I call like this:
.masonry(v-masonry, transition-duration='1s')
          v-card(
            v-masonry-tile,
            v-for='profile in items',
            :key='profile.id'
            )
            v-img(:src="`${profile.avatar}`", aspect-ratio='2')

Throws errors:
spoiler
[Vue warn]: Property or method "v" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declari...

THAT: The plugin itself works, but somehow it's not clear and clumsy
About the hooks, it's clear, sort of. But what or how should I call in it? I used it in Vue.use(VueMasonryPlugin). Everything should work.(?)
Link to vue-masonry turnip

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wlms, 2019-02-28
@smlwmy

The problem was solved like this:
Not working variant
.div( v-masonry transition-duration='3s', item-selector='.item')
Working variant
.div( v-masonry='', transition-duration='3s', item-selector='.item')
Apparently Jade specifics

K
karambafe, 2019-02-28
@karambafe

This error usually occurs when a template uses a variable that is not declared in the component in data/props/computed.
In a vacuum, it's hard to tell if it's a plugin error or a code inside a component.
I made a small example where I just connected the library and used the v-mansory directive - there are no errors in the console ( codesanbox ), so most likely you need to look for jambs in the component template

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question