Comments (5)
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.
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.
I have to import it like this: import Flipbook from 'flipbook-vue/dist/vue2/flipbook.mjs'
now it works :)
from flipbook-vue.
@ts1 did you find out how to make it work with Nuxt.js ?
from flipbook-vue.
@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)
- Nuxt error when going backwards
- startPage toggle page HOT 5
- Duplicate image names cause the animation to switch abnormally. HOT 2
- examples/demo is bad
- How to change this color?Thanks
- Getting Maximum recursive updates exceeded when trying to use the library HOT 5
- Flipbook functionality break
- Question: How to implement flip on click? HOT 2
- Cannot build using Vue 3 HOT 1
- Import flipbook-vue/vue2 not recognized HOT 7
- How to setup touch&swipe for images inside viewport. HOT 1
- Next pages show current page instead of loader when flipping HOT 8
- Nuxt 3 example? HOT 3
- Installation new flipbook HOT 1
- How to add pdfs and epubs? HOT 2
- Background transparent on flipped page animation HOT 2
- Switching pages fast with arrow keys messes up the images HOT 2
- Error when using flipbook-vue in nuxt
- Force odd/even pages to show on certain side of the flipbook HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flipbook-vue.