浏览代码

fix anchor positions

Olivier Massot 1 年之前
父节点
当前提交
3fa205158b
共有 1 个文件被更改,包括 12 次插入2 次删除
  1. 12 2
      components/Layout/AnchoredSection.vue

+ 12 - 2
components/Layout/AnchoredSection.vue

@@ -1,5 +1,6 @@
 <template>
 <template>
-  <div :id="id" ref="section" v-scroll="onScroll">
+  <div ref="section" class="section" v-scroll="onScroll">
+    <div :id="id" class="anchor" />
     <slot />
     <slot />
   </div>
   </div>
 </template>
 </template>
@@ -48,4 +49,13 @@ const onScroll = (scroll) => {
 }
 }
 </script>
 </script>
 
 
-<style scoped></style>
+<style scoped lang="scss">
+.section {
+  //position: relative;
+}
+
+.anchor {
+  position: relative;
+  top: -54px;
+}
+</style>