This commit is contained in:
670788339
2025-10-31 18:36:22 +08:00
parent dfc22479bb
commit 2e7fa1cc2e
2 changed files with 22 additions and 1 deletions

View File

@@ -607,6 +607,27 @@ export default {
// 限制最多5个标签
if (tags.length > 5) {
this.$message.warning('最多只能选择5个标签')
// 只保留前5个标签
const limitedTags = tags.slice(0, 5)
// 更新标签显示
let ids = "";
limitedTags.forEach(tag => {
console.log("父组件name : ", tag.tagName)
ids += tag.id + ',';
})
this.courseInfo.tags = ids;
console.log("父组件ids : ", this.courseInfo.tags)
// 更新showTags确保显示与实际数据一致
this.showTags = limitedTags.map(tag => tag.tagName);
// 重要:返回截断后的标签数组,确保子组件也同步更新
this.$nextTick(() => {
if (this.$refs.courseTag) {
// 通知子组件同步标签状态
this.$refs.courseTag.syncTags(limitedTags);
}
});
return
}
let ids = "";

View File

@@ -2694,7 +2694,7 @@ a.custom2 {
gap: 15px;
align-items: center;
padding-top: 2px;
margin-left: 90px; /* 为"热点标签:"文本留出空间 */
//margin-left: 90px; /* 为"热点标签:"文本留出空间 */
}
/* 调整option-item样式以适应换行布局 */