forked from opentiny/tiny-vue
fix(docs): Fix the abnormal display of anchor component after official website route switching. (#917)
This commit is contained in:
parent
b52733017d
commit
d718297be9
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue