在vue中使用css3实现滑屏,只放了关键代码,其它的没啥了
<template lang="pug">
ul(
@touchstart.prevent='handleTouchStart'
@touchmove='handleTouchMove'
@touchend='handleTouchEnd'
)
li
img(
src='./page1.png'
class='page-img'
)
li
img(
src='./page2.png'
class='page-img'
)
li
img(
src='./page3.png'
class='page-img'
)
</template>
<script>
export default {
data() {
return {
touchStatus: true,
startY: 0,
endY: 0,
diff: 0,
timer: null,
curPage: 0,
imgUrls: [
'/page1.png',
'/page2.png',
'/page3.png'
]
};
},
computed: {
},
methods: {