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