stylus动态改变样式

来源:互联网 发布:手机后期软件 编辑:程序博客网 时间:2024/06/05 10:54

当某个链接或元素被选中时可以时,需要改变其颜色或状态,而stylus中提供&选择器,&指向父选择器,用于判断父元素达到某条件时改变状态,下面的例子中当父元素router-link有被选中(active)时,子元素改变颜色并加上下划线。

//html<router-link tag="div" class="tab-item" to="/recommend">   <span class="tab-link"></span></router-link>//css.tab-link      padding-bottom: 5px      color: $color-text-1&.router-link-active  .tab-link      color: $color-theme      border-bottom: 2px solid $color-theme
原创粉丝点击