(css)列表点击前后样式

(css)列表点击前后样式


效果:


html

c 复制代码
<ul v-show="rightOne" class="one-content">
  <li
    v-for="(item,index) in exampleList"
    :key="index"
    @click="searchHandle(item,index)"
    class="liClass"
    :class="{ 'active': change1 === index }"//不可少
    tabindex="1" //不可少
  >
    <div class="liTip">
      <div class="liTipmini"></div>
    </div>
    <span class="liSpan" :title="item">{{item}}</span>
  </li>
</ul>

css

css 复制代码
.one-content {
  height: 84%;
  background-image: url("../assets/image/list-background.png");
  background-size: 100% 100%;
  padding: 0px 10px 10px 30px;
  font-size: 16px;
  font-family: Medium-font;
  overflow-y: auto;
  .liClass {
    line-height: 50px;
    padding: 0 10px;
    border-bottom: 1px solid rgba(3, 92, 222, 0.4);
    display: flex;
    align-items: center;
    color: #8a8989;
    cursor: pointer;
    .liTip {
      width: 14px;
      height: 14px;
      border: 1px solid #8a8989;
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      .liTipmini {
        width: 4px;
        height: 4px;
        background-color: #8a8989;
        border-radius: 50%;
      }
    }
    .liSpan {
      width: 95%;
      margin-left: 10px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }
  .active {
    color: #fff !important;
    border-bottom: 1px solid #7fd6b4 !important;
    .liTip {
      border: none;
      .liTipmini {
        background-color: #fff;
      }
    }
  }
  .liClass:hover,
  .liClass:focus {
    color: #fff;
    border-bottom: 1px solid #7fd6b4;
    .liTip {
      border: none;
      .liTipmini {
        background-color: #fff;
      }
    }
  }
}
相关推荐
子兮曰2 小时前
async/await高级模式:async迭代器、错误边界与并发控制
前端·javascript·github
恋猫de小郭3 小时前
2026 Flutter VS React Native ,同时在 AI 时代 VS Native 开发,你没见过的版本
android·前端·flutter
GIS之路5 小时前
ArcGIS Pro 中的 Notebooks 入门
前端
IT_陈寒6 小时前
React状态管理终极对决:Redux vs Context API谁更胜一筹?
前端·人工智能·后端
Kagol7 小时前
TinyVue 支持 Skills 啦!现在你可以让 AI 使用 TinyVue 组件搭建项目
前端·agent·ai编程
柳杉7 小时前
从零打造 AI 全球趋势监测大屏
前端·javascript·aigc
simple_lau7 小时前
Cursor配置MasterGo MCP:一键读取设计稿生成高还原度前端代码
前端·javascript·vue.js
睡不着先生7 小时前
如何设计一个真正可扩展的表单生成器?
前端·javascript·vue.js
天蓝色的鱼鱼7 小时前
模块化与组件化:90%的前端开发者都没搞懂的本质区别
前端·架构·代码规范
明君879977 小时前
Flutter 如何给图片添加多行文字水印
前端·flutter