<template>
  <TopNav />
  <!-- <QRCode /> -->
  <router-view />
</template>
<script setup>
import TopNav from 'cpns/TopNav'
import { toAnchor } from '@/common/utils'
import { useSwiperStore } from '@/store'
import { onMounted } from 'vue'
const swiperStore = useSwiperStore()
onMounted(() => {
  window.addEventListener(
    'popstate',
    function (event) {
      if (event.state) {
        const url = event.state.url
        const index = toAnchor(url)
        swiperStore.swiper.slideTo(index, 0, false)
      }
    },
    false,
  )
})
</script>
