V
V
Victor L2017-10-17 12:59:34
Vue.js
Victor L, 2017-10-17 12:59:34

And once again how to connect a component to a component in vue-cli?

I am studying vue-cli, there is a main App.vue component inside there is a Card.vue with a photo, now I found the Lightbox component for Vue.js and I want to use it
npm install --save vlightbox //installed
how to connect it correctly and
tried to use it in main. js add

import lightbox from 'vlightbox'
Vue.use(lightbox)
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  template: '<App/>',
  components: { App,lightbox }
})

and then in Card.vue already use
<lightbox 
        :images="images" 
        title="Feed Gallery"
    ></lightbox>

but the error tell me how to do it right

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2017-10-17
@Fzero0

And what kind of mistake is that?
In main.js it should be like this:

import lightbox from 'vlightbox'
Vue.use(lightbox)

You don't need to specify lightbox in components.
In App.vue import card, specify it in components.
In Card.vue, data must contain an array of images with image data.

A
Artem0071, 2017-10-17
@Artem0071

remove the lightbox from here: components: { App,lightbox }
If it doesn't help, then remove it anyway, and at the same time remove everything from main.js associated with the plugin and insert it already where it should be used

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question