|
@@ -1,20 +1,20 @@
|
|
|
<template>
|
|
|
<Teleport to="body">
|
|
|
<ul class="nav">
|
|
|
- <li class="active" num="1">
|
|
|
+ <li data-menuanchor="section1" class="active" @click="handleSlideTo(1)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
|
<h3>首页</h3>
|
|
|
</div>
|
|
|
</li>
|
|
|
- <li num="3" class="">
|
|
|
+ <li data-menuanchor="section3" @click="handleSlideTo(3)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
|
<h3>开篇</h3>
|
|
|
</div>
|
|
|
</li>
|
|
|
|
|
|
- <li num="4">
|
|
|
+ <li @click="handleSlideTo(4)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
|
<p>第一章</p>
|
|
@@ -22,7 +22,7 @@
|
|
|
</div>
|
|
|
</li>
|
|
|
|
|
|
- <li num="22">
|
|
|
+ <li @click="handleSlideTo(22)">
|
|
|
<i></i>
|
|
|
<div class="title">
|
|
|
<p>第二章</p>
|
|
@@ -48,9 +48,28 @@
|
|
|
</Teleport>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
+import { computed, onMounted, watch, watchEffect } from "vue";
|
|
|
+const props = defineProps({
|
|
|
+ fullpage: Object,
|
|
|
+});
|
|
|
+const current = computed(() => props.fullpage.api.tActiveSection());
|
|
|
defineOptions({
|
|
|
name: "nav-guide",
|
|
|
});
|
|
|
+onMounted(() => {
|
|
|
+ watchEffect(() => {
|
|
|
+ if (props.fullpage) {
|
|
|
+ console.log("props.fullpage", props.fullpage);
|
|
|
+ }
|
|
|
+ });
|
|
|
+});
|
|
|
+
|
|
|
+const handleSlideTo = (index) => {
|
|
|
+ if (props.fullpage) {
|
|
|
+ console.log("index", index);
|
|
|
+ props.fullpage.api.moveTo(index);
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
.nav {
|
|
@@ -66,13 +85,7 @@ defineOptions({
|
|
|
justify-content: center;
|
|
|
margin-bottom: 10vh;
|
|
|
cursor: pointer;
|
|
|
- &.active {
|
|
|
- .title {
|
|
|
- opacity: 1;
|
|
|
- visibility: visible;
|
|
|
- padding-left: 2rem;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
&::after {
|
|
|
content: "";
|
|
|
position: absolute;
|
|
@@ -119,6 +132,15 @@ defineOptions({
|
|
|
font-size: 1.25rem;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ &:hover,
|
|
|
+ &.active {
|
|
|
+ .title {
|
|
|
+ opacity: 1;
|
|
|
+ visibility: visible;
|
|
|
+ padding-left: 2rem;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|