mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 11:26:43 +08:00
修复标签模块查询不显示以及新建标签
This commit is contained in:
@@ -1001,6 +1001,26 @@ export default {
|
||||
//点击标签
|
||||
handleTagClick(item, list) {
|
||||
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();
|
||||
},
|
||||
//三级分类
|
||||
|
||||
Reference in New Issue
Block a user