Skip to content

Commit 8a653b9

Browse files
committed
docs(switch): add activeIcon
1 parent aebf462 commit 8a653b9

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

docs/src/lib/i18n/zh/switch.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ export default {
99
cswitch04020:
1010
'使用activeText属性与inactiveText属性来设置开关的文字描述。 使用 inlinePrompt 属性来控制文本是否显示在点内。',
1111
cswitch04030: '使用activeText属性与inactiveText属性来设置开关的文字描述。',
12+
cswitch05010: '显示自定义图标',
13+
cswitch05020:
14+
'使用 activeIcon 和 inactiveIcon slot来添加图标。 使用 inlinePrompt 属性来控制图标显示在点内。',
1215
};

docs/src/routes/component/switch/+page.svelte

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
22
import { SvelSwitch } from '@svelement-ui/all';
3+
import { Check, Close } from '@svelement-ui/icon';
34
import Example from '$lib/example.svelte';
45
import { getContext } from 'svelte';
56
@@ -95,5 +96,36 @@
9596
/>
9697
</Example>
9798

99+
<h2>{$langFn('cswitch05010')}</h2>
100+
<p>{$langFn('cswitch05020')}</p>
101+
<Example
102+
code={`
103+
<script>
104+
import { Check, Close } from '@svelement-ui/icon';
105+
@@@/>
106+
<SvelSwitch>
107+
<Check slot="activeIcon" />
108+
<Close slot="inactiveIcon" />
109+
</SvelSwitch>
110+
111+
<br />
112+
<SvelSwitch inlinePrompt>
113+
<Check slot="activeIcon" />
114+
<Close slot="inactiveIcon" />
115+
</SvelSwitch>
116+
`}
117+
>
118+
<SvelSwitch>
119+
<Check slot="activeIcon" />
120+
<Close slot="inactiveIcon" />
121+
</SvelSwitch>
122+
123+
<br />
124+
<SvelSwitch inlinePrompt>
125+
<Check slot="activeIcon" />
126+
<Close slot="inactiveIcon" />
127+
</SvelSwitch>
128+
</Example>
129+
98130
<style>
99131
</style>

0 commit comments

Comments
 (0)