docs: name casing in doc (#4944)

* doc: convert the name of icon components to kebab-case

* doc: copy kebab cased icon name
pull/4956/head
根号三 2021-11-30 21:08:51 +08:00 committed by GitHub
parent 4a80b556f8
commit fbabea9065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 26 deletions

View File

@ -18,12 +18,12 @@ Import icons from `@ant-design/icons-vue`, component name of icons with differen
<template> <template>
<div class="icons-list"> <div class="icons-list">
<HomeOutlined /> <home-outlined />
<SettingFilled /> <setting-filled />
<SmileOutlined /> <smile-outlined />
<SyncOutlined spin /> <sync-outlined spin />
<SmileOutlined :rotate="180" /> <smile-outlined :rotate="180" />
<LoadingOutlined /> <loading-outlined />
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">

View File

@ -18,7 +18,7 @@ Create a reusable Vue component by using `Icon`. The property / slot `component`
<template> <template>
<div class="custom-icons-list"> <div class="custom-icons-list">
<Icon :style="{ color: 'hotpink' }"> <icon :style="{ color: 'hotpink' }">
<template #component> <template #component>
<svg width="1em" height="1em" fill="currentColor" viewBox="0 0 1024 1024"> <svg width="1em" height="1em" fill="currentColor" viewBox="0 0 1024 1024">
<path <path
@ -26,9 +26,9 @@ Create a reusable Vue component by using `Icon`. The property / slot `component`
/> />
</svg> </svg>
</template> </template>
</Icon> </icon>
<Icon :style="{ fontSize: '32px' }"> <icon :style="{ fontSize: '32px' }">
<template #component="svgProps"> <template #component="svgProps">
<svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor" v-bind="svgProps"> <svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor" v-bind="svgProps">
<path <path
@ -73,7 +73,7 @@ Create a reusable Vue component by using `Icon`. The property / slot `component`
/> />
</svg> </svg>
</template> </template>
</Icon> </icon>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">

View File

@ -8,19 +8,19 @@ title:
## zh-CN ## zh-CN
双色图标可以通过 `twoToneColor` 属性设置主题色 双色图标可以通过 `two-tone-color` 属性设置主题色
## en-US ## en-US
You can set `twoToneColor` prop to specific primary color for two-tone icons. You can set `two-tone-color` prop to specific primary color for two-tone icons.
</docs> </docs>
<template> <template>
<div class="icons-list"> <div class="icons-list">
<SmileTwoTone /> <smile-two-tone />
<HeartTwoTone two-tone-color="#eb2f96" /> <heart-two-tone two-tone-color="#eb2f96" />
<CheckCircleTwoTone two-tone-color="#52c41a" /> <check-circle-two-tone two-tone-color="#52c41a" />
</div> </div>
</template> </template>
<script> <script>

View File

@ -27,9 +27,9 @@ We still have three different themes for icons, icon component name is the icon
```jsx ```jsx
import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue'; import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue';
<StarOutlined /> <star-outlined />
<StarFilled /> <star-filled />
<StarTwoTone twoToneColor="#eb2f96" /> <star-two-tone two-tone-color="#eb2f96" />
``` ```
### Custom Icon ### Custom Icon
@ -60,7 +60,7 @@ The properties `theme`, `component` and `twoToneColor` were added in `1.2.0`. Th
```html ```html
<template> <template>
<MessageOutlined :style="{fontSize: '16px', color: '#08c'}" /> <message-outlined :style="{fontSize: '16px', color: '#08c'}" />
</template> </template>
<script> <script>
import { MessageOutlined } from '@ant-design/icons-vue'; import { MessageOutlined } from '@ant-design/icons-vue';

View File

@ -16,7 +16,6 @@ npm install --save @ant-design/icons-vue
安装 [Kitchen Sketch 插件 💎](https://kitchen.alipay.com),就可以一键拖拽使用 Ant Design 和 Iconfont 的海量图标,还可以关联自有项目。 安装 [Kitchen Sketch 插件 💎](https://kitchen.alipay.com),就可以一键拖拽使用 Ant Design 和 Iconfont 的海量图标,还可以关联自有项目。
## API ## API
### 通用图标 ### 通用图标
@ -33,9 +32,9 @@ npm install --save @ant-design/icons-vue
```jsx ```jsx
import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue'; import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue';
<StarOutlined /> <star-outlined />
<StarFilled /> <star-filled />
<StarTwoTone twoToneColor="#eb2f96" /> <star-two-tone two-tone-color="#eb2f96" />
``` ```
### 自定义 Icon/Custom Icon ### 自定义 Icon/Custom Icon
@ -62,7 +61,7 @@ import { StarOutlined, StarFilled, StarTwoTone } from '@ant-design/icons-vue';
```html ```html
<template> <template>
<MessageOutlined :style="{fontSize: '16px', color: '#08c'}" /> <message-outlined :style="{fontSize: '16px', color: '#08c'}" />
</template> </template>
<script> <script>
import { MessageOutlined } from '@ant-design/icons-vue'; import { MessageOutlined } from '@ant-design/icons-vue';

View File

@ -7,7 +7,7 @@
<component :is="allIcons[name]"></component> <component :is="allIcons[name]"></component>
<span class="anticon-class"> <span class="anticon-class">
<a-badge :dot="isNew"> <a-badge :dot="isNew">
{{ type }} {{ kebabCasedType }}
</a-badge> </a-badge>
</span> </span>
</li> </li>
@ -19,15 +19,27 @@ import { defineComponent } from 'vue';
const allIcons = AntdIcons; const allIcons = AntdIcons;
const kebabCase = function kebabCase(str) {
return str
.split(/(?=[A-Z])/)
.join('-')
.toLowerCase();
};
export default defineComponent({ export default defineComponent({
components: { components: {
'a-badge': Badge, 'a-badge': Badge,
}, },
props: ['name', 'type', 'isNew', 'theme', 'justCopied'], props: ['name', 'type', 'isNew', 'theme', 'justCopied'],
data() { data() {
const kebabCasedName = kebabCase(this.name);
const kebabCasedType = kebabCase(this.type);
this.allIcons = allIcons; this.allIcons = allIcons;
return { return {
text: `<${this.name} />`, text: `<${kebabCasedName} />`,
kebabCasedType,
}; };
}, },
methods: { methods: {