123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <script setup>
- import { ref, onMounted } from 'vue'
- import { useRouter } from 'vue-router'
- const router = useRouter()
- import BambooBookScene1 from '@/views/BambooBookScene1.vue'
- import BambooBookScene2 from '@/views/BambooBookScene2.vue'
- import BambooBookScene3 from '@/views/BambooBookScene3.vue'
- // 当前滑动到第几屏
- const curIndex = ref(0)
- const toBack = () => {
- router.replace({
- name: 'MoreContent',
- query: {
- anchorIdx: 1,
- }
- })
- }
- const data1 = configZhuPu['杆']
- const data2 = configZhuPu['枝']
- const data3 = configZhuPu['叶']
- const curList = ref([])
- const isStart = ref(true)
- const isBack = ref(false)
- const NextPage = (curPart) => {
- // curIndex.value = 2
- isShowIndex3.value = true
- switch (curPart) {
- case 1:
- curList.value = data1
- return
- case 2:
- curList.value = data2
- return
- case 3:
- curList.value = data3
- return
- }
- }
- const isChange = ref(false)
- const onSlideRight = () => {
- curIndex.value = 1
- isChange.value = true
- }
- const onSlideLeft = () => {
- isStart.value = false
- curIndex.value = 0
- }
- const isShowIndex3 = ref(false)
- </script>
- <template>
- <div class="home">
- <!-- 第一屏 -->
- <Transition name="fade-in-out">
- <div class="page1">
- <BambooBookScene1
- v-if="curIndex !== 2"
- :class="{ 'goLeft1':curIndex === 1,'goRight1':curIndex === 0 && !isStart }"
- @slide-right="onSlideRight"
- @close="toBack"
- />
- <BambooBookScene2
- v-if="curIndex == 1 || curIndex == 0 && !isStart"
- :class="{ 'goLeft2':curIndex === 1 ,'goRight2':curIndex === 0 && !isStart && !isBack}"
- class="onRight2"
- :ischange="isChange"
- @slide-left="onSlideLeft"
- @next="NextPage"
- @close="onSlideLeft"
- />
- </div>
- </Transition>
- <!-- 第二屏 -->
- <!-- <Transition name="fade-in-out">
- </Transition> -->
- <!-- 第三屏 -->
- <Transition name="fade-in-out">
- <BambooBookScene3
- v-if="isShowIndex3"
- :list="curList"
- @close="() => { isShowIndex3 = false }"
- />
- </Transition>
- </div>
- </template>
- <style lang="less" scoped>
- .home {
- width: 100%;
- height: 100%;
- // .onRight1{
- // }
- .page1 {
- width: 100%;
- height: 100%;
- .onLeft1{
- transform: translateX(-100%);
- }
- .onLeft2{
- transform: translateX(0%);
- }
- .onRight1{
- transform: translateX(0%);
- }
- .onRight2 {
- transform: translateX(100%)
- }
- .goLeft1 {
- animation: on-left1 1.5s forwards;
- @keyframes on-left1 {
- 0% {
- transform: translateX(0);
- }
- 100% {
- transform: translateX(-100%);
- }
- }
- }
- .goLeft2 {
- animation: on-left2 1.5s forwards;
- @keyframes on-left2 {
- 0% {
- transform: translateX(100%);
- }
- 100% {
- transform: translateX(0%);
- }
- }
- }
- .goRight1 {
- animation: on-right1 1.5s forwards;
- @keyframes on-right1 {
- 0% {
- transform: translateX(-100%);
- }
- 100% {
- transform: translateX(0%);
- }
- }
- }
- .goRight2 {
- animation: on-right2 1.5s forwards;
- @keyframes on-right2 {
- 0% {
- transform: translateX(0%);
- }
- 100% {
- transform: translateX(100%);
- }
- }
- }
- }
- }
- </style>
|