feat(sites): add attribute api is sorted by dictionary (#1028)

* feat(sites): [button] add attribute api is sorted by dictionary

* feat(sites): [button] add attribute api is sorted by dictionary

* feat(sites): [button] add attribute api is sorted by dictionary
This commit is contained in:
ajaxzheng 2023-12-05 15:17:48 +08:00 committed by GitHub
parent 84e72fa79f
commit e1d3c542b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -41,7 +41,7 @@
<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">
<div class="mt20" v-for="oneGroup in currJson.apis" :key="oneGroup.name">
<div class="ti-f-r ti-f-pos-start ti-fw-bold">
<div :id="oneGroup.name" class="ti-f18">{{ oneGroup.name }}</div>
<div class="ti-ml12 ti-b-a-primary ti-c-primary ti-px8 ti-py4">{{ oneGroup.type }}</div>
@ -68,7 +68,7 @@
</tr>
</thead>
<tbody>
<tr v-for="row in oneApiArr" :key="row.name">
<tr v-for="row in oneApiArr.sort((a, b) => a.name.localeCompare(b.name))" :key="row.name">
<td>
<a v-if="row.demoId" @click="jumpToDemo(row.demoId)">{{ row.name }}</a>
<span v-else>{{ row.name }}</span>
@ -219,6 +219,7 @@ export default defineComponent({
// hashtry catchjs
scrollTarget = document.querySelector(`#${hash}`)
} catch (err) {
// eslint-disable-next-line no-console
console.log('querySelector has special character:', err)
}
if (scrollTarget) {
@ -287,6 +288,7 @@ export default defineComponent({
}
// 3cmpId.js
// eslint-disable-next-line no-eval
const json = eval('(' + jsData.slice(15) + ')')
state.currJson = {
...json,
@ -295,12 +297,14 @@ export default defineComponent({
}
if (state.cmpId?.startsWith('grid-')) {
fetchDemosFile(`${staticDemoPath}/grid/webdoc/grid.js`).then((data) => {
// eslint-disable-next-line no-eval
const gridJson = eval('(' + data.slice(15) + ')')
state.currJson.apis = gridJson.apis
state.currJson.types = gridJson.types
})
} else if (state.cmpId?.startsWith('chart-')) {
fetchDemosFile(`${staticDemoPath}/chart/webdoc/chart.js`).then((data) => {
// eslint-disable-next-line no-eval
const chartJson = eval('(' + data.slice(15) + ')')
state.currJson.apis = chartJson.apis
})

View File

@ -83,12 +83,8 @@
<div class="node-name-container">
<tiny-tag v-if="data?.mode?.includes('mobile-first')" effect="plain">多端</tiny-tag>
<span class="node-name-label">{{ data.label }}</span>
<tiny-tag
v-if="data.mark?.text"
class="node-float-tip"
effect="dark"
:type="data.mark?.type">
{{ data.mark.text}}
<tiny-tag v-if="data.mark?.text" class="node-float-tip" effect="dark" :type="data.mark?.type">
{{ data.mark.text }}
</tiny-tag>
</div>
</template>
@ -113,7 +109,7 @@ import { Switch, TreeMenu, Dropdown, DropdownMenu, DropdownItem, Tooltip, Tag }
import { iconHelpCircle } from '@opentiny/vue-icon'
import { genMenus } from '@/menus.jsx'
import { router } from '@/router.js'
import { $t2, $t, appData, appFn, useApiMode, useTemplateMode } from '@/tools'
import { $t2, appData, appFn, useApiMode, useTemplateMode } from '@/tools'
import themeSvg from '@/assets/images/theme.svg?url'
import useTheme from '@/tools/useTheme'