<template>
    <view class="df fdr jcsb aic" @click="skipSearch">
        <text :style="titleStyle" v-if="typeof title == 'string'">{{ title }}</text>
        <view v-else>
            <uni-tag class="uni-tag" :inverted="true" :text="item.text" type="warning" v-for="(item, index) in title"
                :key="index" />
        </view>
        <uni-icons v-if="icon && isShowIcon" :type="icon" size="18" class="icon"></uni-icons>
    </view>
</template>
<script setup>
const emit = defineEmits(['click'])
const props = defineProps({
    title: {
        type: [String, Array]
    },
    titleStyle: {
        type: Object,
        default: {}
    },
    // 是否显示图标 false 禁止 true 允许
    isShowIcon: {
        type: Boolean,
        default: false
    },
    icon: {
        type: String,
        default: 'right'
    },
    //是否允许点击
    isClick: {
        type: Boolean,
        default: true
    }
})
const skipSearch = () => {
    // 判断是否为跳转
    if (!props.isClick) return;
    emit('click')
}
</script>
<style lang="scss" scoped>
.icon {
    color: #D8D8D8 !important;
}

.uni-tag {
    margin: 0 6rpx;
}
</style>