Skip to content

Commit 59af338

Browse files
authored
feat: add the hideSaas attribute to hide the demo and related properties (#3788)
* feat: add the hideSaas attribute to hide the demo and related properties * fix(carousel): hidden Saas official website vertical rotation example * fix: modify the comments
1 parent 6b52d57 commit 59af338

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

examples/sites/demos/apis/config-provider.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export default {
5151
'en-US': 'Customized theme color, in {data:"tv-base-color-brand":"#595959",....} format.'
5252
},
5353
mode: ['pc'],
54-
pcDemo: 'theme'
54+
pcDemo: 'theme',
55+
hideSaas: true // 当环境变量为tiny-vue-saas时隐藏该属性
5556
}
5657
],
5758
events: [],

examples/sites/demos/pc/app/carousel/webdoc/carousel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ export default {
9797
'zh-CN': '<p>通过配置 <code>type</code> 属性为<code>vertical</code>即可实现纵向轮播。</p>\n',
9898
'en-US': '<p>Set <code>type</code> to vertical to implement <code>vertical</code> rotation. </p>\n'
9999
},
100-
codeFiles: ['up-down-carousel.vue']
100+
codeFiles: ['up-down-carousel.vue'],
101+
hideSaas: true
101102
},
102103
{
103104
demoId: 'show-title',

examples/sites/demos/pc/app/config-provider/webdoc/config-provider.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export default {
5454
'zh-CN': '可通过<code>theme</code>属性设置自定义主题色常量。',
5555
'en-US': 'You can use the <code>theme</code> property to set a custom theme color constant.'
5656
},
57-
codeFiles: ['theme.vue']
57+
codeFiles: ['theme.vue'],
58+
hideSaas: true // 当环境变量为tiny-vue-saas时隐藏该属性
5859
}
5960
],
6061
features: [

examples/sites/src/components/anchor.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ const props = defineProps({ anchorAffix: {}, currentJson: {}, activeTab: {}, lan
2323
const emit = defineEmits(['link-click'])
2424
2525
// 实例锚点
26-
const demoAnchorLinks = computed(() => {
27-
const links =
28-
props.currentJson?.demos?.map((demo) => ({
26+
const demoAnchorLinks = computed(() =>
27+
(props.currentJson?.demos || [])
28+
.filter((demo) => (isSaas ? !demo.hideSaas : true))
29+
.map((demo) => ({
2930
key: demo.demoId,
3031
title: demo.name[props.langKey],
3132
link: `#${demo.demoId}`
32-
})) || []
33-
return links
34-
})
33+
}))
34+
)
3535
3636
// 组件API锚点
3737
const apiAnchorLinks = computed(() => {

examples/sites/src/views/components-doc/common.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ import DesignToken from '../../components/design-token.vue'
114114
import McpDocs from '../../components/mcp-docs.vue'
115115
import useTasksFinish from '../../composable/useTasksFinish'
116116
import list from '@opentiny/vue-theme/token'
117+
import { isSaas } from '../../const'
117118
import { getTinyVueMcpConfig } from '@opentiny/tiny-vue-mcp'
118119
import { camelize, capitalize } from '@vue/shared'
119120
@@ -207,7 +208,7 @@ const parseApiData = () => {
207208
for (const apiType of Object.keys(apiGroup)) {
208209
if (Array.isArray(apiGroup[apiType]) && apiGroup[apiType].length) {
209210
const apiArr = apiGroup[apiType].map((i) => {
210-
const { name, type, defaultValue, desc, demoId, typeAnchorName, linkTo, meta, versionTipOption } = i
211+
const { name, type, defaultValue, desc, demoId, typeAnchorName, linkTo, meta, versionTipOption, hideSaas } = i
211212
const item = {
212213
name,
213214
type,
@@ -217,7 +218,8 @@ const parseApiData = () => {
217218
meta,
218219
versionTipOption,
219220
typeAnchorName: '',
220-
linkTo
221+
linkTo,
222+
hideSaas
221223
}
222224
if (typeAnchorName) {
223225
item.typeAnchorName = `${typeAnchorName?.includes('#') ? '' : '#'}${typeAnchorName}`
@@ -233,6 +235,15 @@ const parseApiData = () => {
233235
234236
tableData[apiGroup.name] = apiDisplay
235237
}
238+
239+
// 当环境变量为tiny-vue-saas时
240+
if (isSaas) {
241+
for (const group of Object.keys(tableData)) {
242+
for (const apiType of Object.keys(tableData[group])) {
243+
tableData[group][apiType] = tableData[group][apiType].filter((item) => !item.hideSaas)
244+
}
245+
}
246+
}
236247
state.tableData = tableData
237248
}
238249

0 commit comments

Comments
 (0)