转换为图片

This commit is contained in:
Smile-Xin 2024-12-05 17:30:42 +08:00
parent 3252af99ee
commit e6a80f668a
14 changed files with 173 additions and 4 deletions

13
package-lock.json generated
View File

@ -11,7 +11,8 @@
"core-js": "^3.8.3",
"jquery": "^3.7.1",
"vue": "^3.2.13",
"vue-router": "^4.5.0"
"vue-router": "^4.5.0",
"vue3-flipbook": "^1.0.4"
},
"devDependencies": {
"@babel/core": "^7.12.16",
@ -11381,6 +11382,16 @@
"dev": true,
"license": "MIT"
},
"node_modules/vue3-flipbook": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/vue3-flipbook/-/vue3-flipbook-1.0.4.tgz",
"integrity": "sha512-H44vAvIFbqBWRf3haBMcpkC24ZstmGHZD5AqHOtrdET6ra3IMghBOfEqQfXbDq3xPp4N8gkNfML08q6wGL4tYQ==",
"license": "MIT",
"workspaces": [
"packages/storybook",
"packages/Flipbook"
]
},
"node_modules/watchpack": {
"version": "2.4.2",
"resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.2.tgz",

View File

@ -11,7 +11,8 @@
"core-js": "^3.8.3",
"jquery": "^3.7.1",
"vue": "^3.2.13",
"vue-router": "^4.5.0"
"vue-router": "^4.5.0",
"vue3-flipbook": "^1.0.4"
},
"devDependencies": {
"@babel/core": "^7.12.16",

View File

@ -1,14 +1,17 @@
<template>
<!-- <img alt="Vue logo" src="./assets/logo.png"> -->
<!-- <HelloWorld msg="Welcome to Your Vue.js App"/> -->
<router-view></router-view>
<!-- <router-view></router-view> -->
<FirstPage />
<!-- <MenuList /> -->
</template>
<script>
import { useRouter } from 'vue-router';
// import HelloWorld from './components/HelloWorld.vue'
// import coffeeIndex from './components/coffeeIndex.vue';
// import MenuList from './components/MenuList.vue';
import FirstPage from './components/FirstPage.vue';
export default {
name: 'App',
@ -16,6 +19,16 @@ export default {
// HelloWorld,
// coffeeIndex
// MenuList
FirstPage
},
setup() {
const goTo = () => {
console.log('go to first page');
useRouter().push('/first');
}
return {
goTo
}
}
}
</script>
@ -40,5 +53,7 @@ body {
background-color: #f5f5f5;
height: 100%;
width: 100%;
overflow: hidden;
}
</style>

BIN
src/assets/page1-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

BIN
src/assets/page1-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

BIN
src/assets/page1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
src/assets/page2-1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

BIN
src/assets/page2-2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

BIN
src/assets/page2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -0,0 +1,138 @@
<template>
<div class="index">
<div id="page">
<img src="../assets/page1.png" alt="" class="pic">
<!-- <img src="../assets/page1-1.png" alt="" class="pic">
<img src="../assets/page1-2.png" alt="" class="pic"> -->
<!-- <img src="../assets/page2-1.jpg" alt="" class="pic">
<img src="../assets/page2-2.jpg" alt="" class="pic"> -->
<img src="../assets/page2.jpg" alt="" class="pic">
</div>
<div class="nextPage" v-on:click="clickHandle()"></div>
<div class="nextPageIn"></div>
<div class="nextPageOut"></div>
</div>
</template>
<script>
import { ref, nextTick, onMounted } from 'vue'
import turn from '../utils/turn.js'
import $ from 'jquery'
export default {
components: {},
setup() {
const imgList = ref([
{ url: '../assets/page1-1.png' },
{ url: '../assets/page1-2.png' },
{ url: '../assets/page2-1.png' },
{ url: '../assets/page2-2.png' },
])
onMounted(() => {
document.querySelector('.nextPageIn').addEventListener('touchstart', () => {
console.log('touchstart')
})
document.querySelector('.nextPageOut').addEventListener('mouseup', () => {
console.log('mouseup')
alert('mouseup')
})
onTurn()
})
const onTurn = () => {
nextTick(() => {
$('#page').turn({
autoCenter: true,
height: 900, //
width: 1500, //
display: 'single', /// single/double
elevation: 50,
duration: 1000, //(), 600ms
gradients: true, //, true
// autoCenter: true, //, false
acceleration: true, //, true, true
page: 1, //
pages: 2, //
turnCorners: 'bl,br',
when: {
//
turning: function (e, page, view) {
console.log(e, page, view)
//
},
turned: function (e, page) {
console.log(e, page)
//
},
start: function (e, pageObj) {
console.log(e, pageObj)
//
// $('#page').turn("next")
}
},
})
})
}
const clickHandle = () => {
console.log('onclick')
}
return {
clickHandle,
imgList,
onTurn
}
}
}
</script>
<style>
.index {
width: 1500px;
height: 900px;
overflow: hidden;
}
.nextPage {
width: 50px;
height: 100%;
background-color: red;
position: absolute;
top: 0px;
right: 50%;
z-index: 99;
}
#page {
width: 100%;
height: 100%;
/* background-image: url(../assets/page1.png); */
}
.nextPageIn {
width: 44%;
height: 50%;
background-color: red;
position: absolute;
top: 80%;
left: 70%;
/* z-index: 5; */
}
.nextPageOut {
width: 44%;
height: 50%;
background-color: rgb(0, 4, 255);
position: absolute;
top: 50%;
left: 50%;
z-index: 5;
}
.pic {
width: 100%;
height: 100%;
}
</style>

View File

@ -3,6 +3,7 @@
import { createWebHashHistory , createRouter } from 'vue-router'
import coffeeIndex from '@/components/coffeeIndex.vue'
import HelloWorld from '@/components/HelloWorld.vue'
import FirstPage from '@/components/FirstPage.vue'
// import MenuItem from '@/view/MenuItem.vue'
const router = createRouter({
@ -14,6 +15,7 @@ const router = createRouter({
},
{ path: '/coffee', component: coffeeIndex },
{ path: '/hello', component: HelloWorld },
{ path: '/first', component: FirstPage },
]
})
export default router

View File

@ -16,8 +16,9 @@
* benefit and not for any commercial purpose or for monetary gain.
*
**/
import jQuery from "jquery";
(function($) {
export default (function($) {
'use strict';

View File

@ -2,6 +2,7 @@ const { defineConfig } = require('@vue/cli-service')
const webpack = require('webpack');
module.exports = defineConfig({
publicPath:'./',
transpileDependencies: true,
lintOnSave : false,
configureWebpack: {