|
@@ -1,6 +1,8 @@
|
|
|
<template>
|
|
|
<Teleport to="body">
|
|
|
- <ul class="nav " v-show="current != 0">
|
|
|
+ current:
|
|
|
+ {{ current }}
|
|
|
+ <ul class="nav" v-show="true">
|
|
|
<li data-menuanchor="section2" class="active" @click="handleSlideTo(1)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
@@ -14,7 +16,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
|
|
|
- <li @click="handleSlideTo(4)">
|
|
|
+ <li data-menuanchor="section4" @click="handleSlideTo(4)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
|
<p>第一章</p>
|
|
@@ -22,7 +24,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
|
|
|
- <li @click="handleSlideTo(14)">
|
|
|
+ <li data-menuanchor="section14" @click="handleSlideTo(14)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
|
<p>第二章</p>
|
|
@@ -30,7 +32,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
|
|
|
- <li @click="handleSlideTo(23)">
|
|
|
+ <li data-menuanchor="section23" @click="handleSlideTo(23)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
|
<p>第三章</p>
|
|
@@ -38,7 +40,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
|
|
|
- <li @click="handleSlideTo(30)">
|
|
|
+ <li data-menuanchor="section30" @click="handleSlideTo(30)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
|
<h3>尾篇</h3>
|
|
@@ -48,9 +50,9 @@
|
|
|
</Teleport>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { computed,ref, onMounted, onUnmounted, watch, watchEffect } from "vue";
|
|
|
+import { computed, ref, onMounted, onUnmounted, watch, watchEffect } from "vue";
|
|
|
import { emitter } from "../emitter.js";
|
|
|
-const current =ref(0)
|
|
|
+const current = ref(0);
|
|
|
const props = defineProps({
|
|
|
fullpage: Object,
|
|
|
});
|
|
@@ -59,10 +61,12 @@ defineOptions({
|
|
|
});
|
|
|
onMounted(() => {
|
|
|
emitter.on("onLeave", (params) => {
|
|
|
- console.log("onLeave", params);
|
|
|
+ // console.log("onLeave", params);
|
|
|
});
|
|
|
emitter.on("afterLoad", (params) => {
|
|
|
- current.value = params.index && params.index.index
|
|
|
+ const { index: currentIndex } = params.index;
|
|
|
+ console.log("afterLoad-currentIndex", currentIndex);
|
|
|
+ // current.value = params.index && params.index.index;
|
|
|
});
|
|
|
});
|
|
|
onUnmounted(() => {
|
|
@@ -141,6 +145,9 @@ const handleSlideTo = (index) => {
|
|
|
|
|
|
&:hover,
|
|
|
&.active {
|
|
|
+ i:after {
|
|
|
+ background-color: #d09d68;
|
|
|
+ }
|
|
|
.title {
|
|
|
opacity: 1;
|
|
|
visibility: visible;
|
|
@@ -149,4 +156,46 @@ const handleSlideTo = (index) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.isMobile .nav {
|
|
|
+ top: 0.6rem;
|
|
|
+
|
|
|
+ transform: none;
|
|
|
+ right: 1rem;
|
|
|
+ text-align: center;
|
|
|
+ li {
|
|
|
+ margin-right: 10vw;
|
|
|
+ margin-bottom: 0;
|
|
|
+ display: inline-block;
|
|
|
+ -webkit-box-pack: center;
|
|
|
+ .title {
|
|
|
+ top: 0;
|
|
|
+ padding-left: 0;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ }
|
|
|
+ &::after {
|
|
|
+ width: 10vw;
|
|
|
+ height: 1px;
|
|
|
+ top: 0;
|
|
|
+ }
|
|
|
+ &.active {
|
|
|
+ .title {
|
|
|
+ padding-top: 1rem;
|
|
|
+ top: 0;
|
|
|
+ padding-left: 0;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ h3 {
|
|
|
+ font-size: 1.1rem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ i {
|
|
|
+ &::after {
|
|
|
+ width: 1.5rem;
|
|
|
+ height: 1.5rem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|