Skip to content

Commit

Permalink
chore: complete en docs (Tencent#2541)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored and methodchen committed Aug 25, 2023
1 parent 2325a60 commit 1515af0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
9 changes: 8 additions & 1 deletion site/plugin-tdoc/md-to-vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ const DEFAULT_TABS = [
{ tab: 'design', name: '指南' },
];

const DEFAULT_EN_TABS = [
{ tab: 'demo', name: 'DEMO' },
{ tab: 'api', name: 'API' },
{ tab: 'design', name: 'Guideline' },
];

export default async function mdToVue(options) {
const mdSegment = await customRender(options);
const { demoDefsStr, demoCodesDefsStr, demoInstallStr, demoCodeInstallStr } = options;
Expand Down Expand Up @@ -132,6 +138,7 @@ async function customRender({ source, file, md }) {
const { content, data } = matter(source);
const lastUpdated = (await getGitTimestamp(file)) || Math.round(fs.statSync(file).mtimeMs);
// console.log('data', data);
const isEn = file.endsWith('en-US.md');

// md top data
const pageData = {
Expand All @@ -141,7 +148,7 @@ async function customRender({ source, file, md }) {
description: '',
isComponent: false,
tdDocHeader: true,
tdDocTabs: DEFAULT_TABS,
tdDocTabs: isEn ? DEFAULT_EN_TABS : DEFAULT_TABS,
apiFlag: /#+\s*API/,
docClass: '',
usage: null,
Expand Down
5 changes: 3 additions & 2 deletions site/site.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ const docs = [
children: [
{
title: '全局特性配置',
titleEn: 'Config',
titleEn: 'Global Configuration',
name: 'config',
path: '/vue/config',
path: '/vue/global-configuration',
component: () => import('tdesign-vue/config-provider/config-provider.md'),
componentEn: () => import('tdesign-vue/config-provider/config-provider.en-US.md'),
},
{
title: '自定义主题',
Expand Down
33 changes: 33 additions & 0 deletions src/config-provider/config-provider.en-US.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
:: BASE_DOC ::

### Global Component Classprefix

the classprefix of TDesign component is `t`. In some situations, it is necessary to change the component prefix to meet the usage needs.

You can use the `esm` version (which guarantees that you can modify less vars), modify the `classPrefix` through global configuration, and cooperate with less-loader to modify the `@prefix` less vars to ensure the normal styling of the components.

```js
import Vue from 'vue'
import TDesign from 'tdesign-vue/esm'
import 'tdesign-vue/esm/style/index.js'

Vue.use(TDesign);
...

<t-config-provider :globalConfig="{ classPrefix: 'any'}">
<t-button>TDesign to any design</t-button>
</t-config-provider>
```

```js
{
loaderOptions: {
less: {
lessOptions: {
modifyVars: {
'@prefix': 'any', // should be the same as classPrefix
},
javascriptEnabled: true,
},
},
}
}
```
## API
### GlobalConfigProvider

Expand Down

0 comments on commit 1515af0

Please sign in to comment.