1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <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.push({
- name: 'MoreContent',
- query: {
- anchorIdx: 1,
- }
- })
- }
- // 第三屏
- const curPart = ref(0)
- const data1 = configZhuPu['杆']
- const data2 = configZhuPu['枝']
- const data3 = configZhuPu['叶']
- const curList = ref([])
- const NextPage = (curPart) => {
- curIndex.value = 2
- switch (curPart) {
- case 1:
- curList.value = data1
- return
- case 2:
- curList.value = data2
- return
- case 3:
- curList.value = data3
- return
- }
- }
- </script>
- <template>
- <div class="home">
- <!-- 第一屏 -->
- <Transition name="fade-in-out">
- <BambooBookScene1
- v-if="curIndex === 0"
- @slide="() => {curIndex = 1}"
- @close="toBack"
- />
- </Transition>
- <!-- 第二屏 -->
- <Transition name="fade-in-out">
- <BambooBookScene2
- v-if="curIndex === 1"
- @next="NextPage"
- @close="() => {curIndex = 0}"
- />
- </Transition>
- <!-- 第三屏 -->
- <Transition name="fade-in-out">
- <BambooBookScene3
- v-if="curIndex === 2"
- :list="curList"
- @close="() => {curIndex = 1}"
- />
- </Transition>
- </div>
- </template>
- <style lang="less" scoped>
- .home {
- width: 100%;
- height: 100%;
- }
- </style>
|