|
5 | 5 | <div class="flex justify-between items-center mb-2"> |
6 | 6 | <label class="block text-sm font-medium">提示词库</label> |
7 | 7 | </div> |
8 | | - <div class="flex flex-wrap gap-2 bg-base-200 p-3 rounded-md"> |
| 8 | + <div class="bg-base-200 p-3 rounded-md"> |
9 | 9 | <!-- 加载状态 --> |
10 | 10 | <div v-if="isLoading" class="text-center text-base-content/50 py-6 w-full flex justify-center items-center"> |
11 | 11 | <i class="icon-[tabler--loader-2] animate-spin mr-2"></i> 正在加载提示词库... |
|
22 | 22 | </div> |
23 | 23 |
|
24 | 24 | <!-- 提示词列表 --> |
25 | | - <div v-else class="flex flex-wrap gap-2 w-full"> |
| 25 | + <div v-else class="w-full"> |
26 | 26 | <!-- 分类选择 --> |
27 | | - <div class="w-full mb-2 flex gap-2 flex-wrap"> |
28 | | - <div class="dropdown"> |
29 | | - <label tabindex="0" class="btn btn-sm"> |
30 | | - {{ selectedCategory || '选择一级分类' }} |
31 | | - <i class="icon-[tabler--chevron-down]"></i> |
32 | | - </label> |
33 | | - <ul tabindex="0" class="dropdown-content z-[1] menu shadow bg-base-100 rounded-box w-52"> |
34 | | - <li><a @click="selectedCategory = ''">全部</a></li> |
35 | | - <li v-for="category in categories" :key="category"> |
36 | | - <a @click="selectedCategory = category">{{ category }}</a> |
37 | | - </li> |
38 | | - </ul> |
| 27 | + <div class="mb-4"> |
| 28 | + <div class="tabs tabs-bordered"> |
| 29 | + <!-- 全部分类选项 --> |
| 30 | + <button |
| 31 | + class="tab" |
| 32 | + :class="{'tab-active': selectedCategory === ''}" |
| 33 | + @click="selectedCategory = ''" |
| 34 | + > |
| 35 | + 全部 |
| 36 | + </button> |
| 37 | + |
| 38 | + <!-- 一级分类选项 --> |
| 39 | + <button |
| 40 | + v-for="category in categories" |
| 41 | + :key="category" |
| 42 | + class="tab" |
| 43 | + :class="{'tab-active': selectedCategory === category}" |
| 44 | + @click="selectedCategory = category" |
| 45 | + > |
| 46 | + {{ category }} |
| 47 | + </button> |
39 | 48 | </div> |
40 | 49 |
|
41 | | - <div class="dropdown" v-if="selectedCategory"> |
42 | | - <label tabindex="0" class="btn btn-sm"> |
43 | | - {{ selectedSubCategory || '选择二级分类' }} |
44 | | - <i class="icon-[tabler--chevron-down]"></i> |
45 | | - </label> |
46 | | - <ul tabindex="0" class="dropdown-content z-[1] menu shadow bg-base-100 rounded-box w-52"> |
47 | | - <li><a @click="selectedSubCategory = ''">全部</a></li> |
48 | | - <li v-for="subCategory in subCategories" :key="subCategory"> |
49 | | - <a @click="selectedSubCategory = subCategory">{{ subCategory }}</a> |
50 | | - </li> |
51 | | - </ul> |
| 50 | + <!-- 二级分类选择 --> |
| 51 | + <div v-if="selectedCategory && subCategories.length > 0" class="mt-2"> |
| 52 | + <div class="badge-group flex flex-wrap gap-2 mt-2"> |
| 53 | + <!-- 全部二级分类选项 --> |
| 54 | + <button |
| 55 | + class="badge badge-outline" |
| 56 | + :class="{'badge-primary': selectedSubCategory === ''}" |
| 57 | + @click="selectedSubCategory = ''" |
| 58 | + > |
| 59 | + 全部 |
| 60 | + </button> |
| 61 | + |
| 62 | + <!-- 二级分类选项 --> |
| 63 | + <button |
| 64 | + v-for="subCategory in subCategories" |
| 65 | + :key="subCategory" |
| 66 | + class="badge badge-outline" |
| 67 | + :class="{'badge-primary': selectedSubCategory === subCategory}" |
| 68 | + @click="selectedSubCategory = subCategory" |
| 69 | + > |
| 70 | + {{ subCategory }} |
| 71 | + </button> |
| 72 | + </div> |
52 | 73 | </div> |
53 | 74 | </div> |
54 | 75 |
|
55 | 76 | <!-- 提示词列表 --> |
56 | | - <button |
57 | | - v-for="(prompt, index) in promptLibraryFiltered" |
58 | | - :key="'lib-prompt-' + index" |
59 | | - class="badge badge-lg badge-secondary h-auto cursor-pointer" |
60 | | - @click="selectPrompt(prompt)" |
61 | | - > |
62 | | - <div class="text-sm">{{ prompt.chinese }}</div> |
63 | | - <div class="text-xs opacity-80">{{ prompt.english }}</div> |
64 | | - </button> |
| 77 | + <div class="flex flex-wrap gap-2"> |
| 78 | + <button |
| 79 | + v-for="(prompt, index) in promptLibraryFiltered" |
| 80 | + :key="'lib-prompt-' + index" |
| 81 | + class="badge badge-lg badge-secondary h-auto cursor-pointer" |
| 82 | + @click="selectPrompt(prompt)" |
| 83 | + > |
| 84 | + <div class="text-sm">{{ prompt.chinese }}</div> |
| 85 | + <div class="text-xs opacity-80">{{ prompt.english }}</div> |
| 86 | + </button> |
| 87 | + </div> |
65 | 88 | </div> |
66 | 89 | </div> |
67 | 90 | </div> |
|
0 commit comments