Giter Club home page Giter Club logo

Comments (5)

ts1 avatar ts1 commented on September 21, 2024 2

not it works
Did it work or not?

I tried it myself, import Flipbook from 'flipbook-vue/dist/vue2/flipbook.mjs' failed to import dependencies of Flipbook.
import Flipbook from 'flipbook-vue/dist/vue2/flipbook.cjs' succeeds.

Anyway, I'll have to investigate how to play nice with Nuxt.

from flipbook-vue.

kabaluyot avatar kabaluyot commented on September 21, 2024 2

Hello.

For Nuxt 2, easiest way is to register it as a plugin component.

Under plugins/components/vue-flipbook.ts, register it as a global Vue component:

import Vue from 'vue'
import Flipbook from 'flipbook-vue/dist/vue2/flipbook.cjs'

Vue.component('Flipbook', Flipbook)

Then in nuxt.config.ts,

  plugins: [
    ...
    { src: '~/plugins/components/vue-flipbook' },
  ],

If you are using TypeScript (Nuxt 2 class component), register a module type so it won't return tslint errors:

declare module 'flipbook-vue/dist/vue2/flipbook.cjs'

Then should work in your vue files:

<template>
  <v-container class="home__container mx-auto">
    <Flipbook
      class="flipbook"
      :pages="[
        null,
        '/book/3.png',
        '/book/1.png',
        '/book/2.png',
        '/book/4.png',
      ]"
    ></Flipbook>
  </v-container>
</template>

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'

@Component({
  layout: 'empty',
  head() {
    return {
      title: 'Home',
    }
  },
})
export default class Index extends Vue {}
</script>

<style scoped>
.flipbook {
  width: 90vw;
  height: 90vh;
}
.home__container {
  max-width: 1440px;
}
</style>

from flipbook-vue.

rafalm-cyber avatar rafalm-cyber commented on September 21, 2024

I have to import it like this: import Flipbook from 'flipbook-vue/dist/vue2/flipbook.mjs' now it works :)

from flipbook-vue.

AndreiD avatar AndreiD commented on September 21, 2024

@ts1 did you find out how to make it work with Nuxt.js ?

from flipbook-vue.

ts1 avatar ts1 commented on September 21, 2024

@AndreiD Not really. It looks like the offender is babel-loader. It is in Nuxt 2 and not in vue-cli, which successfully builds in examples/vue2module.

from flipbook-vue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.