In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use vue2.x+turn.js to achieve the effect of flipping books", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use vue2.x+turn.js to achieve the effect of flipping books"!
Using turn.js in vue
Download the source code from the official website: http://turnjs.com/
Find the file inside lib/turn.js
Put it in the newly created utils file
Turn.js is written in jquery, and jquery should be introduced into vue.
Npm install-save jquery
Create a new vue.config.js profile
Const webpack = require ('webpack') module.exports = {chainWebpack: config = > {/ / introduce ProvidePlugin config.plugin ("provide") .use (webpack.ProvidePlugin, [{$: "jquery", jquery: "jquery", jQuery: "jquery", "window.jQuery": "jquery",},]);},}
I introduce official documents to local picture files.
To view the pixels of the file, the width is 2 times height when setting the width and height.
Use the contents of the vue file
/ / turn.jsimport turn from'.. / utils/turn.js'export default {name: 'Home', data () {return {imgUrl: [{imgurl:'image/1.jpg',index:1}, {imgurl:'image/2.jpg',index:2}, {imgurl:'image/3.jpg',index:3}, {imgurl:'image/4.jpg',index:4} {imgurl:'image/5.jpg',index:5}, {imgurl:'image/6.jpg',index:6}, {imgurl:'image/7.jpg',index:7}, {imgurl:'image/8.jpg',index:8}, {imgurl:'image/9.jpg',index:9}, {imgurl:'image/10.jpg',index:10} {imgurl:'image/11.jpg',index:11}, {imgurl:'image/12.jpg',index:12},]}, methods: {onTurn () {this.$nextTick () = > {$("# flipbook") .turn ({autoCenter: true, height:646, width:996,}) })}, mounted () {this.onTurn ();}} * {margin: 0; padding: 0;} .home {width: 100vW; height: 100vh; .turnClass {display: flex; margin: 0px auto; width: 996px; height: 646px; padding: calc ((100vh-646px) / 2) 0; overflow: hidden }} Thank you for your reading, the above is the content of "how to use vue2.x+turn.js to achieve the effect of flipping books". After the study of this article, I believe you have a deeper understanding of how to use vue2.x+turn.js to achieve the effect of flipping books, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.