|
|
@@ -52,10 +52,10 @@ export interface TagProps {
|
|
|
*/
|
|
|
type?: TagTypes,
|
|
|
/**
|
|
|
- * 设置 plain 属性设置为空心样式。
|
|
|
- * @default false
|
|
|
+ * 设置 plain 属性设置为空心样式。设置 light 属性设置为浅色样式。
|
|
|
+ * @default 'default'
|
|
|
*/
|
|
|
- plain?: boolean,
|
|
|
+ scheme?: 'plain'|'light'|'default',
|
|
|
/**
|
|
|
* 形状 通过 square 设置方形,通过 round 设置圆形, mark设置标记样式(半圆角)。
|
|
|
* @default 'round'
|
|
|
@@ -107,7 +107,7 @@ const themeContext = useTheme();
|
|
|
const props = withDefaults(defineProps<TagProps>(), {
|
|
|
shape: () => propGetThemeVar('TagShape', 'round'),
|
|
|
type: () => propGetThemeVar('TagType', 'default'),
|
|
|
- plain: () => propGetThemeVar('TagPlain', false),
|
|
|
+ scheme: () => propGetThemeVar('TagScheme', 'default'),
|
|
|
size: () => propGetThemeVar('TagSize', 'medium'),
|
|
|
borderRadius: () => propGetThemeVar('TagBorderRadius', 20),
|
|
|
textColor: () => propGetThemeVar('TagTextColor'),
|
|
|
@@ -155,6 +155,26 @@ const themeStyles = themeContext.useThemeStyles({
|
|
|
borderColor: DynamicColor('TagPlainDangerBorderColor', 'danger'),
|
|
|
color: DynamicColor('TagPlainDangerColor', 'danger'),
|
|
|
},
|
|
|
+ lightTagDefault: {
|
|
|
+ backgroundColor: DynamicColor('TagLightDefaultBackgroundColor', 'background.button'),
|
|
|
+ color: DynamicColor('TagLightDefaultColor', 'text.content'),
|
|
|
+ },
|
|
|
+ lightTagPrimary: {
|
|
|
+ backgroundColor: DynamicColor('TagLightPrimaryBackgroundColor', 'background.primary'),
|
|
|
+ color: DynamicColor('TagLightPrimaryColor', 'primary'),
|
|
|
+ },
|
|
|
+ lightTagSuccess: {
|
|
|
+ color: DynamicColor('TagLightSuccessColor', 'success'),
|
|
|
+ backgroundColor: DynamicColor('TagLightSuccessBackgroundColor', 'background.success'),
|
|
|
+ },
|
|
|
+ lightTagWarning: {
|
|
|
+ backgroundColor: DynamicColor('TagLightWarningBackgroundColor', 'background.warning'),
|
|
|
+ color: DynamicColor('TagLightWarningColor', 'warning'),
|
|
|
+ },
|
|
|
+ lightTagDanger: {
|
|
|
+ backgroundColor: DynamicColor('TagLightDangerBackgroundColor', 'background.danger'),
|
|
|
+ color: DynamicColor('TagLightDangerColor', 'danger'),
|
|
|
+ },
|
|
|
tagDefault: {
|
|
|
backgroundColor: DynamicColor('TagDefaultBackgroundColor', 'button'),
|
|
|
color: DynamicColor('TagDefaultColor', 'black'),
|
|
|
@@ -204,19 +224,31 @@ const style = computed(() => {
|
|
|
borderBottomRightRadius: borderRadius,
|
|
|
},
|
|
|
}),
|
|
|
- ...selectStyleType<ViewStyle, TagTypes>(props.type, 'default', props.plain ? {
|
|
|
- default: themeStyles.plainTagDefault.value,
|
|
|
- primary: themeStyles.plainTagPrimary.value,
|
|
|
- success: themeStyles.plainTagSuccess.value,
|
|
|
- warning: themeStyles.plainTagWarning.value,
|
|
|
- danger: themeStyles.plainTagDanger.value,
|
|
|
- } : {
|
|
|
- default: themeStyles.tagDefault.value,
|
|
|
- primary: themeStyles.tagPrimary.value,
|
|
|
- success: themeStyles.tagSuccess.value,
|
|
|
- warning: themeStyles.tagWarning.value,
|
|
|
- danger: themeStyles.tagDanger.value,
|
|
|
- }),
|
|
|
+ ...selectStyleType<ViewStyle, TagTypes>(props.type, 'default',
|
|
|
+ selectStyleType(props.scheme, 'default', {
|
|
|
+ default: {
|
|
|
+ default: themeStyles.tagDefault.value,
|
|
|
+ primary: themeStyles.tagPrimary.value,
|
|
|
+ success: themeStyles.tagSuccess.value,
|
|
|
+ warning: themeStyles.tagWarning.value,
|
|
|
+ danger: themeStyles.tagDanger.value,
|
|
|
+ },
|
|
|
+ plain: {
|
|
|
+ default: themeStyles.plainTagDefault.value,
|
|
|
+ primary: themeStyles.plainTagPrimary.value,
|
|
|
+ success: themeStyles.plainTagSuccess.value,
|
|
|
+ warning: themeStyles.plainTagWarning.value,
|
|
|
+ danger: themeStyles.plainTagDanger.value,
|
|
|
+ },
|
|
|
+ light: {
|
|
|
+ default: themeStyles.lightTagDefault.value,
|
|
|
+ primary: themeStyles.lightTagPrimary.value,
|
|
|
+ success: themeStyles.lightTagSuccess.value,
|
|
|
+ warning: themeStyles.lightTagWarning.value,
|
|
|
+ danger: themeStyles.lightTagDanger.value,
|
|
|
+ },
|
|
|
+ }),
|
|
|
+ ),
|
|
|
...selectStyleType<ViewStyle, TagSizes>(props.size, 'medium', {
|
|
|
mini: themeStyles.tagSizeMini.value,
|
|
|
small: themeStyles.tagSizeSmall.value,
|
|
|
@@ -227,9 +259,11 @@ const style = computed(() => {
|
|
|
|
|
|
} as ViewStyle;
|
|
|
if (color !== undefined) {
|
|
|
- if (props.plain) {
|
|
|
+ if (props.scheme === 'plain') {
|
|
|
style.borderColor = color;
|
|
|
style.color = color;
|
|
|
+ } else if (props.scheme === 'light') {
|
|
|
+ style.color = color;
|
|
|
} else {
|
|
|
style.backgroundColor = color;
|
|
|
}
|