File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 24
24
/** @type {String, Number} */
25
25
export let tabindex;
26
26
export let beforeChange = null ;
27
+ export let width = null ;
27
28
$: size = size || getContext (' svel-size' );
28
29
$: isControlled = value !== false ;
29
30
$: actualValue = value;
81
82
function handleInputKeydown ({ key }) {
82
83
console .log (key);
83
84
}
85
+
86
+ $: coreStyle = a2st ([[` width` , width ? ` ${ width} px` : null ]]);
84
87
</script >
85
88
86
89
<div class ={switchKls } on:click ={switchValue } {style }>
109
112
{/if }
110
113
</span >
111
114
{/if }
112
- <span class =" svel-switch__core" >
115
+ <span class ="svel-switch__core" style ={ coreStyle } >
113
116
{#if inlinePrompt }
114
117
<div class =" svel-switch__inner" >
115
118
{#if activeIcon || inactiveIcon }
116
119
<SvelIcon />
117
120
{:else if activeText || inactiveText }
118
- <span class ="is-text" aria-hidden =" !checked" >{checked ? activeText : inactiveText }</span >
121
+ <span class ="is-text" aria-hidden ={ ! checked } >{checked ? activeText : inactiveText }</span >
119
122
{/if }
120
123
</div >
121
124
{/if }
Original file line number Diff line number Diff line change 19
19
<div />
20
20
<SvelSwitch activeText =" Pay by month" inactiveText =" Pay by year" />
21
21
<SvelSwitch activeText =" Y" inactiveText =" N" inlinePrompt />
22
+ <div />
23
+ <SvelSwitch activeText =" 超出省略" inactiveText =" 超出省略" inlinePrompt width =" 60" />
24
+ <div />
25
+ <SvelSwitch activeText =" 完整展示多个内容" inactiveText =" 多个内容" inlinePrompt />
22
26
23
27
<div />
You can’t perform that action at this time.
0 commit comments