当前链接高亮

查看源码

属性参考

注册名 data-controller="auto-active"
Targets
Values
Outlets

给链接做当前页高亮:连接时比较 element.pathname 与 location.pathname,相同则加 .is-active。配合 .menu .menu-item 使用,比服务端判断当前路由更省事。

<a data-controller="auto-active" href="/ui/bulma/auto_active" class="menu-item">当前页</a>

只适用于带 pathname 的元素(a / area);.menu-item.is-active 的样式来自 bulma/components/menu_ext.scss。