Skip to content

Commit 52012da

Browse files
committed
fix(switch): add docs and all
1 parent 6875b3a commit 52012da

File tree

7 files changed

+49
-1
lines changed

7 files changed

+49
-1
lines changed

docs/src/lib/component_info.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const component_group_list = [
1818
{ key: 'checkbox', name: 'ccheckbox01010' },
1919
{ key: 'radio', name: 'cradio01010' },
2020
{ key: 'slider', name: 'cslider01010' },
21+
{ key: 'switch', name: 'cswitch01010' },
2122
],
2223
},
2324
{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import inputNumber from '$lib/i18n/zh/input_number.js';
1212
import radio from '$lib/i18n/zh/radio.js';
1313
import tooltip from '$lib/i18n/zh/tooltip.js';
1414
import slider from '$lib/i18n/zh/slider.js';
15+
import _switch from '$lib/i18n/zh/switch.js';
1516

1617
export const langDict = {
1718
...util,
@@ -28,6 +29,7 @@ export const langDict = {
2829
...inputNumber,
2930
...tooltip,
3031
...slider,
32+
..._switch,
3133
};
3234

3335
function getText(key) {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
cswitch01010: 'Switch 开关',
3+
cswitch01011: '表示两种相互对立的状态间的切换,多用于触发「开/关」。',
4+
cswitch02010: '基础用法',
5+
cswitch02020:
6+
'绑定 value 到一个 Boolean 类型的变量。 可以使用 --svel-switch-on-color 属性与 --svel-switch-off-color 属性来设置开关的背景色。',
7+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script>
2+
import { SvelSwitch } from '@svelement-ui/all';
3+
import Example from '$lib/example.svelte';
4+
import { getContext } from 'svelte';
5+
6+
let langFn = getContext('langFn');
7+
8+
let value1 = true;
9+
let value2 = true;
10+
</script>
11+
12+
<h1>{$langFn('cswitch01010')}</h1>
13+
<p>{$langFn('cswitch01011')}</p>
14+
15+
<h2>{$langFn('cswitch02010')}</h2>
16+
<p>{$langFn('cswitch02020')}</p>
17+
<p>{$langFn('cswitch02030')}</p>
18+
<Example
19+
code={`
20+
`}
21+
>
22+
<SvelSwitch bind:value={value1} />
23+
<SvelSwitch
24+
bind:value={value2}
25+
class="ml-2"
26+
style="--svel-switch-on-color: #13ce66; --svel-switch-off-color: #ff4949"
27+
/>
28+
</Example>
29+
30+
<style>
31+
</style>

packages/all/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"scroll",
2424
"slider",
2525
"space",
26-
"autocomplete"
26+
"autocomplete",
27+
"switch"
2728
],
2829
"exports": {
2930
".": {
@@ -49,6 +50,7 @@
4950
"@svelement-ui/radio": "workspace:^",
5051
"@svelement-ui/scrollbar": "workspace:^",
5152
"@svelement-ui/slider": "workspace:^",
53+
"@svelement-ui/switch": "workspace:^",
5254
"@svelement-ui/theme-chalk": "workspace:^",
5355
"@svelement-ui/tooltip": "workspace:^",
5456
"@svelement-ui/util-array-2-class-string": "workspace:^"

packages/all/src/lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import SvelInput from '@svelement-ui/input';
1919
import SvelInputNumber from '@svelement-ui/input-number';
2020
import SvelSlider from '@svelement-ui/slider';
2121
import SvelTooltip from '@svelement-ui/tooltip';
22+
import SvelSwitch from '@svelement-ui/switch';
2223

2324
export {
2425
SvelAside,
@@ -44,4 +45,5 @@ export {
4445
SvelInputNumber,
4546
SvelSlider,
4647
SvelTooltip,
48+
SvelSwitch,
4749
};

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)