feat(docs): sync mobile position on anchor click (#11879)

This commit is contained in:
Jevon
2023-05-20 18:46:50 +08:00
committed by GitHub
parent 52ab19e185
commit b275e1867d
2 changed files with 28 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
<template>
<div class="van-doc-demo-block">
<h2 v-if="title" class="van-doc-demo-block__title">{{ title }}</h2>
<h2 v-if="title" class="van-doc-demo-block__title" :id="slugifyTitle">
{{ title }}
</h2>
<div v-if="card" class="van-doc-demo-block__card">
<slot />
</div>
@@ -9,6 +11,8 @@
</template>
<script>
import { slugify } from 'transliteration';
export default {
name: 'DemoBlock',
@@ -16,6 +20,11 @@ export default {
card: Boolean,
title: String,
},
computed: {
slugifyTitle() {
return slugify(this.title);
},
},
};
</script>