|
|
@@ -0,0 +1,79 @@
|
|
|
+<template>
|
|
|
+ <div class="conversation-board-tags">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) of list_labels"
|
|
|
+ class="board-tag"
|
|
|
+ :class="{ 'is-active': item.labelId === current_id }"
|
|
|
+ :key="item.labelId"
|
|
|
+ @click="handleClick(item)"
|
|
|
+ >
|
|
|
+ <span>{{ item.labelName }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ref, onMounted } from 'vue';
|
|
|
+
|
|
|
+import useTagList from './use-tag-list';
|
|
|
+
|
|
|
+/**
|
|
|
+ * 此组件为初期实现版本
|
|
|
+ * 没有 全部 按钮
|
|
|
+ * 仅可在已有的标签中点击任意一个进行选择
|
|
|
+ */
|
|
|
+
|
|
|
+const emits = defineEmits(['change']);
|
|
|
+
|
|
|
+const current_id = ref('');
|
|
|
+
|
|
|
+const handleClick = (item) => {
|
|
|
+ const target_id = item.labelId;
|
|
|
+
|
|
|
+ if (target_id === current_id.value) {
|
|
|
+ // 已经选中了
|
|
|
+ current_id.value = '';
|
|
|
+ } else {
|
|
|
+ // 没有选中
|
|
|
+ current_id.value = target_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ emits('change', current_id.value);
|
|
|
+};
|
|
|
+
|
|
|
+const { getTagList, api_status, api_message, list_labels } = useTagList();
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getTagList();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="css" scoped>
|
|
|
+.conversation-board-tags {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ margin-top: 40px;
|
|
|
+ margin-bottom: 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.conversation-board-tags .board-tag {
|
|
|
+ margin-left: 5px;
|
|
|
+ margin-right: 5px;
|
|
|
+
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ padding: 10px;
|
|
|
+ padding-left: 16px;
|
|
|
+ padding-right: 16px;
|
|
|
+
|
|
|
+ border-radius: 8px;
|
|
|
+
|
|
|
+ background-color: var(--color-bg-1);
|
|
|
+ color: var(--color-text-1);
|
|
|
+}
|
|
|
+
|
|
|
+.conversation-board-tags .board-tag.is-active {
|
|
|
+ background-color: rgb(var(--primary-6));
|
|
|
+ color: #fff;
|
|
|
+}
|
|
|
+</style>
|