chore: tag增加圆角参数

This commit is contained in:
Hefeng
2024-01-16 16:12:05 +08:00
parent 0adc35cda9
commit 76ce3a293c

View File

@ -1,8 +1,8 @@
<!--
* @Author: peerless_hero peerless_hero@outlook.com
* @Date: 2023-07-11 02:12:08
* @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-11-16 12:32:51
* @LastEditors: Hefeng 1057605508@qq.com
* @LastEditTime: 2024-01-16 12:59:41
* @FilePath: \uni\packages\tag\index.vue
* @Description:
*
@ -20,7 +20,6 @@
font-500
border-2rpx
border-solid
rd-8rpx
>
&nbsp;&nbsp;&nbsp;{{ text }}&nbsp;&nbsp;&nbsp;
</text>
@ -31,6 +30,7 @@ import { computed } from 'vue'
const props = withDefaults(
defineProps<{
radius?: boolean
/** 类型 */
type?: 'default' | 'primary' | 'danger' | 'warning' | 'success' | 'info'
/** 显示文本 */
@ -40,22 +40,24 @@ const props = withDefaults(
}>(),
{
type: 'default',
},
)
const className = computed(() => {
const bg = props.plain ? '' : ' bgc'
const rd = props.radius ? ' rd-full' : ' rd-8rpx'
switch (props.type) {
case 'danger':
return `th-tag-danger${bg}`
return `th-tag-danger${bg} ${rd}`
case 'primary':
return `th-tag-primary${bg}`
return `th-tag-primary${bg} ${rd}`
case 'warning':
return `th-tag-warning${bg}`
return `th-tag-warning${bg} ${rd}`
case 'success':
return `th-tag-success${bg}`
return `th-tag-success${bg} ${rd}`
default:
return `th-tag-default${bg}`
return `th-tag-default${bg} ${rd}`
}
})
</script>