antdesign的tree样式修改:点击下一步tree章节标题自动高亮

一、需求描述

左侧是树形结构的菜单,右侧是每个章节对应的内容,点击下一步按钮,左侧章节标题自动高亮,右侧内容为下一章标题的内容。

二、实现

1)自定义插槽

const scopedSlots = { title:'custom' }
TreeData.forEach(item=>{
	item.scopedSlots = scopedSlots;
	if(item.children){
		item.children.forEach(child=>{
			child.scopedSlots = scopedSlots
		}
	}
})
  1. 当点击的key对于数据中的key时添加style样式

	

3)修改原来的a-tree被选中的样式(被选中的默认样式会自动高亮的样式同时出现,所以要将默认的设置为透明)

.ant-tree-treenode-selected{
	span{
		background-color: transparent !important;  
	}
}

参考文章:参考文章链接点这里

你可能感兴趣的:(javascript,anti-design-vue)