YGChatCS/pages/module/attach/AttachListComponent.vue
2025-08-27 18:37:50 +08:00

65 lines
1.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="tag-list">
<view
v-for="(item, index) in tags"
:key="index"
class="tag-item"
@click="handleClick(item)"
>
<text class="tag-text">{{ item }}</text>
</view>
</view>
</template>
<script setup>
import { ref, nextTick, defineEmits } from "vue";
import { onMounted } from "vue";
import { SCROLL_TO_BOTTOM } from "@/constant/constant";
const props = defineProps({
question: {
type: String,
default: "",
},
});
const tags = ref([]);
const emits = defineEmits(["replySent"]);
const handleClick = (item) => {
emits("replySent", item);
};
onMounted(() => {
tags.value = props.question.split(/[&|;]/).filter((tag) => tag.trim() !== "");
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true);
}, 300);
});
});
</script>
<style scoped lang="scss">
.tag-list {
display: flex;
flex-wrap: wrap;
padding: 6px 12px;
}
.tag-item {
background-color: #ffffff;
border-radius: 8px;
padding: 4px 10px;
margin-right: 8px;
margin-bottom: 8px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.tag-text {
color: #00a6ff; /* 蓝色文字可根据设计调整 */
font-size: 14px;
}
</style>