fix(docs): Fix the abnormal display of anchor component after official website route switching. (#917)

This commit is contained in:
ajaxzheng 2023-11-24 19:17:46 +08:00 committed by GitHub
parent b52733017d
commit d718297be9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -112,6 +112,7 @@
<tiny-anchor
:is-affix="true"
:links="anchorLinks"
:key="anchorRefreshKey"
mask-class="custom-active-anchor"
@link-click="handleAnchorClick"
>
@ -123,7 +124,7 @@
</template>
<script lang="jsx">
import { defineComponent, reactive, computed, toRefs, watch, onMounted, onUnmounted, nextTick } from 'vue'
import { defineComponent, reactive, computed, toRefs, watch, onMounted, ref } from 'vue'
import { marked } from 'marked'
import { Loading, Anchor, ButtonGroup, ColumnListGroup } from '@opentiny/vue'
import debounce from '@opentiny/vue-renderless/common/deps/debounce'
@ -148,6 +149,7 @@ export default defineComponent({
loading: Loading.directive
},
setup() {
const anchorRefreshKey = ref(0)
const state = reactive({
webDocPath: computed(() => ''),
langKey: $t2('zh-CN', 'en-US'),
@ -361,6 +363,8 @@ export default defineComponent({
state.currJson = {}
} else {
loadPage()
//
anchorRefreshKey.value++
}
}
)
@ -390,6 +394,7 @@ export default defineComponent({
...toRefs(state),
...fn,
$t,
anchorRefreshKey,
apiModeState,
templateModeState,
optionsList