mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-08 01:58:52 +08:00
parent
21f0b178b6
commit
5e55da4839
@ -1,5 +1,5 @@
|
|||||||
import type { ExtractPropTypes, PropType } from 'vue'
|
import type { ExtractPropTypes, PropType } from 'vue'
|
||||||
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp } from '../common/props'
|
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp, numericProp } from '../common/props'
|
||||||
|
|
||||||
export type SwitchBeforeChangeOption = {
|
export type SwitchBeforeChangeOption = {
|
||||||
value: number | string | boolean
|
value: number | string | boolean
|
||||||
@ -47,7 +47,9 @@ export const switchProps = {
|
|||||||
/**
|
/**
|
||||||
* 大小
|
* 大小
|
||||||
*/
|
*/
|
||||||
size: makeNumericProp(28),
|
size: {
|
||||||
|
type: numericProp
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 在改变前执行的函数
|
* 在改变前执行的函数
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onBeforeMount } from 'vue'
|
import { computed, type CSSProperties, onBeforeMount } from 'vue'
|
||||||
import { addUnit, isFunction, objToStyle } from '../common/util'
|
import { addUnit, isFunction, objToStyle } from '../common/util'
|
||||||
import { switchProps } from './types'
|
import { switchProps } from './types'
|
||||||
|
|
||||||
@ -27,11 +27,13 @@ const rootClass = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const rootStyle = computed(() => {
|
const rootStyle = computed(() => {
|
||||||
const rootStyle: Record<string, any> = {
|
const rootStyle: CSSProperties = {
|
||||||
'font-size': addUnit(props.size),
|
|
||||||
background: props.modelValue === props.activeValue ? props.activeColor : props.inactiveColor,
|
background: props.modelValue === props.activeValue ? props.activeColor : props.inactiveColor,
|
||||||
'border-color': props.modelValue === props.activeValue ? props.activeColor : props.inactiveColor
|
'border-color': props.modelValue === props.activeValue ? props.activeColor : props.inactiveColor
|
||||||
}
|
}
|
||||||
|
if (props.size) {
|
||||||
|
rootStyle['font-size'] = addUnit(props.size)
|
||||||
|
}
|
||||||
return `${objToStyle(rootStyle)};${props.customStyle}`
|
return `${objToStyle(rootStyle)};${props.customStyle}`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@vue/tsconfig/tsconfig.json",
|
"extends": "@vue/tsconfig/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"verbatimModuleSyntax":true,
|
||||||
"ignoreDeprecations": "5.0",
|
"ignoreDeprecations": "5.0",
|
||||||
"lib": [
|
"lib": [
|
||||||
"ESNext",
|
"ESNext",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user