fix(sites): fix api table link error (#754)

* fix(sites): fix api table link error

* fix(sites): fix api table link error

* fix(sites): fix api table link error
This commit is contained in:
gimmyhehe 2023-11-07 19:48:43 -08:00 committed by GitHub
parent 949eb49b87
commit b7b845efcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 11 deletions

View File

@ -32,7 +32,7 @@
</div>
</template>
<template v-if="currJson.apis?.length > 0">
<div id="API" @click="handleApiClick($event)">
<div id="API">
<h2 class="ti-f30 ti-fw-normal ti-mt28">API</h2>
<!-- apis 是一个数组 {name,type,properties:[原table内容],events:[] ...........} -->
<div class="mt20" v-for="(oneGroup, idx) in currJson.apis" :key="oneGroup.name">
@ -313,16 +313,8 @@ export default defineComponent({
} else {
router.push(`#${demoId}`)
}
},
handleApiClick: (ev) => {
if (ev.target.tagName === 'A') {
ev.preventDefault()
const href = ev.target.getAttribute('href')
const hash = $split(href, '#', -1)
router.push(href)
state.singleDemo = state.currJson.demos.find((d) => d.demoId === hash)
scrollByHash(hash)
if (apiModeState.demoMode === 'single') {
state.singleDemo = state.currJson.demos.find((d) => d.demoId === demoId)
}
},
handleTypeClick: (ev) => {