feat: 完成对话结束的标签
This commit is contained in:
65
pages/module/attach/AttachListComponent.vue
Normal file
65
pages/module/attach/AttachListComponent.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user