123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <view
- class="fs-tag"
- :class="[
- {
- 'fs-tag-round': round,
- 'fs-tag-plain': plain,
- 'fs-tag-mark': mark,
- 'fs-tag-mark-reverse': markReverse,
- 'fs-tag-none': closed
- },
- 'fs-tag-' + size,
- 'bg-' + type,
- ]"
- :style="[
- {color:color,backgroundColor:bgColor},
- customStyle
- ]">
- <slot></slot>
- <fs-icon
- class="fs-tag-close"
- size="13px"
- type="icon-close1"
- v-if="closable"
- @click="handleClosed">
- </fs-icon>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- const props = defineProps({
- plain: Boolean,
- round: Boolean,
- mark: Boolean,
- markReverse: Boolean,
- closable: Boolean,
- type: {
- type: String,
- default: 'primary',
- validator(value) {
- return ['primary', 'success', 'info', 'warning', 'danger', 'default'].includes(value)
- }
- },
- color: String,
- bgColor: String,
- size: String,
- customStyle: {
- type: Object,
- default() {
- return {}
- }
- },
- })
- const closed = ref(false)
- const handleClosed = () => {
- closed.value = true
- }
- </script>
- <style lang="scss" scoped>
- .fs-tag{
- display: inline-flex;
- height: 38rpx;
- line-height: 38rpx;
- padding: 0 10rpx;
- font-size: 11px;
- color: #fff;
- vertical-align: middle;
- border-radius: 4rpx;
- align-items: center;
- white-space: nowrap;
-
- &-plain{
- background-color: transparent !important;
- line-height: 32rpx;
- border: 2rpx solid currentColor;
-
- &.bg-default{
- color: var(
- }
- &.bg-primary{
- color: var(
- }
- &.bg-success{
- color: var(
- }
- &.bg-warning{
- color: var(
- }
- &.bg-info{
- color: var(
- }
- &.bg-danger{
- color: var(
- }
- }
-
- &-round{
- border-radius: 30rpx;
- }
- &-mark{
- border-radius: 0 25rpx 25rpx 0;
- }
- &-mark-reverse{
- border-radius: 25rpx 0 0 25rpx;
- }
-
- &-medium{
- font-size: 12px;
- height: 48rpx;
- line-height: 48rpx;
- padding: 0 20rpx;
- &.plain{
- line-height: 48rpx;
- }
- }
- &-large{
- font-size: 13px;
- height: 58rpx;
- line-height: 58rpx;
- padding: 0 30rpx;
- &.fs-tag-plain{
- line-height: 58rpx;
- }
- &.fs-tag-mark-reverse{
- border-radius: 50rpx 0 0 50rpx;
- }
- }
-
- &-close{
- margin-left: 8rpx;
- }
- &-none{
- display: none;
- }
- }
- .bg-default{
- background-color: #cfcfcf;
- }
- </style>
|