修复标签模块查询不显示以及新建标签

This commit is contained in:
王卓煜
2025-08-22 15:16:01 +08:00
parent 32cae2aee4
commit fadd4c5006

View File

@@ -1001,6 +1001,26 @@ export default {
//点击标签 //点击标签
handleTagClick(item, list) { handleTagClick(item, list) {
item.checked = !item.checked; item.checked = !item.checked;
// 收集所有选中的标签只保留需要传递的字段如id、tagName等
const checkedTags = list.filter(item => item.checked).map(item => ({
id: item.id,
tagName: item.tagName,
// 其他需要传递的字段
}));
// 正确的实现方式:
let tagIds = '';
checkedTags.forEach(tag => {
tagIds += tag.id + ',';
});
// // 移除末尾可能的逗号
// if (tagIds.length > 0) {
// tagIds = tagIds.slice(0, -1);
// }
this.course.tags = tagIds
// 打印当前选中的标签ID数组用于调试
console.log("当前选中的标签ID:", this.course.tags);
// 调用搜索方法
this.searchData(); this.searchData();
}, },
//三级分类 //三级分类