ragnarlotus / vue-flux

Image slider which comes with 20 cool transitions
https://ragnarlotus.github.io/vue-flux-docs/demos/demos
MIT License
542 stars 49 forks source link

Multiple slide shows need same imported options #78

Closed midlantica closed 4 years ago

midlantica commented 4 years ago

I have 6 distinct slide shows in my site. I want them all to share the same options.

I tried to import vueFluxVars.js:

const vueFluxVars = {
  autoplay: true,
  enableGestures: true,
  infinite: true,
  bindKeys: true,
  delay: 3000,
  width: 98,
  toggleFullscreen: true,
  allowFullscreen: true,
  lazyLoad: true,
  autohideTime: 2500
}

console.log(vueFluxVars) /// <<-- this appears correctly in console 

Then in vue-flux slides file:

import './vueFluxVars.js'

data: () => ({
      vfOptions: vueFluxVars,
     .......

Always comes in 'undefined'.

Sorry, bit of a newbie.

Maybe I'm not doing it the Vue way? Suggestions?

ragnarlotus commented 4 years ago

Hello, your problem is just related to ES module system.

You need to ' export default vueFluxVars at the end of vueFluxVars.js, so it exports something by default.

And then in the slides use import vueFluxVars from './vueFluxVars.js' so you retrieve what you export.

Regards

midlantica commented 4 years ago

Gracias, señor! I feel like I did that already.. but I guess not! 👍