mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-06 17:18:40 +08:00
parent
21f0b178b6
commit
5e55da4839
@ -1,5 +1,5 @@
|
||||
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 = {
|
||||
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 lang="ts" setup>
|
||||
import { computed, onBeforeMount } from 'vue'
|
||||
import { computed, type CSSProperties, onBeforeMount } from 'vue'
|
||||
import { addUnit, isFunction, objToStyle } from '../common/util'
|
||||
import { switchProps } from './types'
|
||||
|
||||
@ -27,11 +27,13 @@ const rootClass = computed(() => {
|
||||
})
|
||||
|
||||
const rootStyle = computed(() => {
|
||||
const rootStyle: Record<string, any> = {
|
||||
'font-size': addUnit(props.size),
|
||||
const rootStyle: CSSProperties = {
|
||||
background: 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}`
|
||||
})
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"verbatimModuleSyntax":true,
|
||||
"ignoreDeprecations": "5.0",
|
||||
"lib": [
|
||||
"ESNext",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user