Skip to content

Commit 1f42566

Browse files
committed
fix: delete faq logic
1 parent 7422717 commit 1f42566

File tree

2 files changed

+18
-42
lines changed

2 files changed

+18
-42
lines changed

examples/sites/src/views/components/cmp-config.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ const languageMap = {
2323
sass: 'css'
2424
}
2525

26-
// 只有select组件需要select.faq.cn.md
27-
const faqMdConfig = {
28-
// TODO: 找不到select的问答md,先关闭
29-
// select: true
30-
}
31-
3226
const getWebdocPath = (path) => {
3327
if (path?.startsWith('grid-') && path !== 'grid-select') {
3428
return 'grid'
@@ -43,4 +37,4 @@ const getWebdocPath = (path) => {
4337

4438
const staticDemoPath = '@demos/app'
4539

46-
export { languageMap, faqMdConfig, vueComponents, getWebdocPath, staticDemoPath }
40+
export { languageMap, vueComponents, getWebdocPath, staticDemoPath }

examples/sites/src/views/components/components.vue

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- 一个组件的文档: 描述md + demos + apis -->
33
<header class="flex-horizontal docs-header">
44
<div class="docs-title-wrap">
5-
<div class="markdown-body markdown-top-body" size="medium" v-html="state.cmpTopMd"></div>
5+
<div class="markdown-body markdown-top-body" v-html="state.cmpTopMd"></div>
66
<version-tip
77
v-if="state.currJson.meta || state.currJson.versionTipOption"
88
:meta="state.currJson.meta"
@@ -194,8 +194,6 @@
194194
</div>
195195
</div>
196196

197-
<h2 id="FAQ" v-if="state.cmpFAQMd" class="ti-f30 ti-fw-normal ti-mt28 ti-mb20">FAQ</h2>
198-
<div class="markdown-body" v-html="state.cmpFAQMd"></div>
199197
<div v-if="state.currJson.owner" class="ti-abs ti-right24 ti-top24" @click="copyText(state.currJson.owner)">
200198
{{ i18nByKey('doc-owner') }} : {{ state.currJson.owner }}
201199
</div>
@@ -210,21 +208,21 @@ import { useRoute } from 'vue-router'
210208
import { marked } from 'marked'
211209
import hljs from 'highlight.js'
212210
import {
213-
Anchor as TinyAnchor,
214-
ButtonGroup as TinyButtonGroup,
215-
Grid as TinyGrid,
216-
GridColumn as TinyGridColumn,
217-
Tabs as TinyTabs,
218-
TabItem as TinyTabItem,
219-
Tooltip as TinyTooltip
211+
TinyAnchor,
212+
TinyButtonGroup,
213+
TinyGrid,
214+
TinyGridColumn,
215+
TinyTabs,
216+
TinyTabItem,
217+
TinyTooltip
220218
} from '@opentiny/vue'
221219
import { iconOuterLink } from '@opentiny/vue-icon'
222220
import debounce from '@opentiny/vue-renderless/common/deps/debounce'
223221
import { i18nByKey, getWord, $clone, fetchDemosFile, useApiMode, useTemplateMode, getCmpContributors } from '@/tools'
224222
import DemoBox from '@/views/components/demo'
225223
import demoConfig from '@demos/config.js'
226224
import { router } from '@/router.js'
227-
import { faqMdConfig, getWebdocPath } from './cmp-config'
225+
import { getWebdocPath } from './cmp-config'
228226
import AsyncHighlight from './async-highlight.vue'
229227
import VersionTip from './VersionTip.vue'
230228
@@ -247,7 +245,6 @@ const state = reactive({
247245
observer: null,
248246
currJson: { column: 1, demos: [], apis: [], types: {} },
249247
cmpTopMd: null,
250-
cmpFAQMd: null,
251248
currDemoId: '',
252249
demoAnchorLinks: computed(() => {
253250
const links =
@@ -256,13 +253,6 @@ const state = reactive({
256253
title: demo.name[state.langKey],
257254
link: `#${demo.demoId}`
258255
})) || []
259-
if (state.cmpFAQMd) {
260-
links.push({
261-
key: 'FAQ',
262-
title: 'FAQ',
263-
link: '#FAQ'
264-
})
265-
}
266256
return links
267257
}),
268258
iframeUrl: '',
@@ -349,15 +339,15 @@ const demoMounted = () => {
349339
}
350340
}
351341
352-
const getIframeConetent = (demoId, demoName) => {
342+
const getIframeContent = (demoId, demoName) => {
353343
const frameWindow = iframeRef.value.contentWindow
354344
frameWindow.postMessage({ from: 'tiny-vue-site', component: state.cmpId, demo: demoName })
355345
router.push(`#${demoId}`)
356346
}
357347
358348
const getIframeDemo = (demo) => {
359349
if (demo?.codeFiles.length > 0) {
360-
getIframeConetent(demo.demoId, demo.codeFiles[0])
350+
getIframeContent(demo.demoId, demo.codeFiles[0])
361351
jumpToMobileDemoAndHash(demo.demoId)
362352
state.currDemoId = demo.demoId
363353
}
@@ -551,14 +541,8 @@ const loadPage = debounce(templateModeState.isSaas ? 100 : 0, false, () => {
551541
promiseArr[1] = fetchDemosFile(`${staticPath.value}/${getWebdocPath(state.cmpId)}/webdoc/${state.cmpId}.js`)
552542
}
553543
554-
if (faqMdConfig[state.cmpId]) {
555-
promiseArr.push(
556-
fetchDemosFile(`${staticPath.value}/${getWebdocPath(state.cmpId)}/webdoc/${state.cmpId}.faq.${lang}.md`)
557-
)
558-
}
559-
560544
Promise.all(promiseArr)
561-
.then(([mdData, jsData, apiData, faqData]) => {
545+
.then(([mdData, jsData, apiData]) => {
562546
// 1、加载顶部md
563547
state.cmpTopMd = marked(mdData, {
564548
gfm: true,
@@ -568,11 +552,6 @@ const loadPage = debounce(templateModeState.isSaas ? 100 : 0, false, () => {
568552
}
569553
})
570554
571-
// 2、加载faq.md
572-
if (faqData) {
573-
state.cmpFAQMd = marked(faqData)
574-
}
575-
576555
// 3、加载cmpId.js 文件
577556
// eslint-disable-next-line no-eval
578557
const json = jsData ? eval('(' + jsData.slice(15) + ')') : {}
@@ -590,10 +569,13 @@ const loadPage = debounce(templateModeState.isSaas ? 100 : 0, false, () => {
590569
591570
if (apiData) {
592571
// eslint-disable-next-line no-eval
593-
const apiJson = eval('(' + apiData.slice(15) + ')')
572+
let apiJson = eval('(' + apiData.slice(15) + ')')
594573
// pc、mobile、mobile-first三种模式
595574
const demoMode = templateModeState.isSaas ? templateModeState.mode : import.meta.env.VITE_APP_MODE
596575
const demoKey = demoMode === 'mobile-first' ? 'mfDemo' : `${demoMode}Demo`
576+
if (demoMode === 'mobile') {
577+
apiJson = json
578+
}
597579
state.currJson.apis = apiJson.apis.map((item) => {
598580
Object.keys(item).forEach((key) => {
599581
const apiItem = item[key]
@@ -742,7 +724,7 @@ const handleAnchorClick = (e, data) => {
742724
if (demoConfig.isMobile) {
743725
// 点击目录列表更新iframe显示
744726
const hashId = data.link.slice(1)
745-
getIframeConetent(state.cmpId, hashId + '.vue')
727+
getIframeContent(state.cmpId, hashId + '.vue')
746728
}
747729
748730
if (apiModeState.demoMode === 'single' && data.link.startsWith('#')) {

0 commit comments

Comments
 (0)