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