mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(Switch): use tsx
This commit is contained in:
parent
bf1f0f57eb
commit
7d0340a35b
@ -1,17 +1,26 @@
|
|||||||
// Utils
|
|
||||||
import { createNamespace, addUnit } from '../utils';
|
import { createNamespace, addUnit } from '../utils';
|
||||||
import { switchProps } from './shared';
|
|
||||||
|
|
||||||
// Composition
|
|
||||||
import { useParentField } from '../composition/use-parent-field';
|
import { useParentField } from '../composition/use-parent-field';
|
||||||
|
|
||||||
// Components
|
|
||||||
import Loading from '../loading';
|
import Loading from '../loading';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('switch');
|
const [createComponent, bem] = createNamespace('switch');
|
||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: switchProps,
|
props: {
|
||||||
|
size: [Number, String],
|
||||||
|
loading: Boolean,
|
||||||
|
disabled: Boolean,
|
||||||
|
modelValue: null as any,
|
||||||
|
activeColor: String,
|
||||||
|
inactiveColor: String,
|
||||||
|
activeValue: {
|
||||||
|
type: null as any,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
inactiveValue: {
|
||||||
|
type: null as any,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
emits: ['change', 'update:modelValue'],
|
emits: ['change', 'update:modelValue'],
|
||||||
|
|
||||||
@ -52,7 +61,7 @@ export default createComponent({
|
|||||||
disabled,
|
disabled,
|
||||||
})}
|
})}
|
||||||
style={style}
|
style={style}
|
||||||
aria-checked={String(checked)}
|
aria-checked={checked}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<div class={bem('node')}>{renderLoading()}</div>
|
<div class={bem('node')}>{renderLoading()}</div>
|
@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* Common Switch Props
|
|
||||||
*/
|
|
||||||
|
|
||||||
export type SharedSwitchProps = {
|
|
||||||
size?: string | number;
|
|
||||||
loading?: boolean;
|
|
||||||
disabled?: boolean;
|
|
||||||
modelValue?: any;
|
|
||||||
activeValue: any;
|
|
||||||
inactiveValue: any;
|
|
||||||
activeColor?: string;
|
|
||||||
inactiveColor?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const switchProps = {
|
|
||||||
size: [Number, String],
|
|
||||||
loading: Boolean,
|
|
||||||
disabled: Boolean,
|
|
||||||
modelValue: null as any,
|
|
||||||
activeColor: String,
|
|
||||||
inactiveColor: String,
|
|
||||||
activeValue: {
|
|
||||||
type: null as any,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
inactiveValue: {
|
|
||||||
type: null as any,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
};
|
|
Loading…
x
Reference in New Issue
Block a user