Home>Article>Web Front-end> Let’s talk about how vue2.x + turn.js achieves the book turning effect

Let’s talk about how vue2.x + turn.js achieves the book turning effect

青灯夜游
青灯夜游 forward
2022-01-17 19:07:16 4656browse

vue2.x turn.js How to achieve the book turning effect? The following article will introduce to you how to use turn.js in vue2.x and achieve the book flipping effect. I hope it will be helpful to you.

Let’s talk about how vue2.x + turn.js achieves the book turning effect

Using turn.js in vue

Preview of the effect:

Let’s talk about how vue2.x + turn.js achieves the book turning effect

Official website download source code: http://turnjs.com/

Let’s talk about how vue2.x + turn.js achieves the book turning effect

Find the file lib/turn.js

Let’s talk about how vue2.x + turn.js achieves the book turning effect

Put it in the newly created utils file

Let’s talk about how vue2.x + turn.js achieves the book turning effect

Turn.js is written using jquery. When using vue, jquery must be introduced

npm install --save jquery

Create new vue.config.js configuration file

const webpack = require('webpack') module.exports = { chainWebpack: config => { //引入ProvidePlugin config.plugin("provide").use(webpack.ProvidePlugin, [{ $: "jquery", jquery: "jquery", jQuery: "jquery", "window.jQuery": "jquery", }, ]); }, }

I introduced the official file into the local image file and used

Let’s talk about how vue2.x + turn.js achieves the book turning effect

to view the pixels of the file when setting the width and height. width is 2 times height unchanged.

Let’s talk about how vue2.x + turn.js achieves the book turning effect

Use vue file content

  

Effect picture:

Let’s talk about how vue2.x + turn.js achieves the book turning effect

[Related recommendations:vue.js tutorial

The above is the detailed content of Let’s talk about how vue2.x + turn.js achieves the book turning effect. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:juejin.cn. If there is any infringement, please contact admin@php.cn delete