我妈已经三天没打我了 2022-07-07 18:01 采纳率: 85.4%
浏览 52
已结题

为什么鼠标经过li的时候没有变色

没有像图片这样变色

img


<template>
  <div class="divInput">
        <div class="input" @click="openValue" :class="['input f16', color === 'blue' ? '' : 'white-color']">
          <input v-model="value" type="text" placeholder="筛选">
          <img src="../assets/images/z_x_jt.png" alt="">
        </div>
        <div class="list" v-show="show">
          <ul>
            <li @click="getvalue(index,item)" v-for="(item,index) in tableData" :key="item.index">{{ item.name }}</li>
          </ul>
        </div>
      </div>
</template>

<script>
export default {
  name: 'javascript',
    data(){
      return{
        tableData:[
          {
            'name':111
          },
          {
            'name':222
          },
          {
            'name':333
          }, {
            'name':444
          }
        ],
        show:false,
        value:'',
      }
    },
    methods: {
      openValue(){
        this.show=!this.show;
      },
      getvalue(index,item){
        this.value=item.name;
        this.show=false;
      },
    },
};
</script>

<style scoped>
.divInput{
  /* margin-top: 100px; */
  /* width: 135px; */
    /* width: 105px;
    background: #3A79EE;
    color: #FFFFFF;
    box-shadow: 0px 10px 20px 0px rgba(144, 119, 222, 0.2);
    border-radius: 20px;
    height: 40px;
    line-height: 40px;
    padding: 0 15px;
    cursor: pointer; */

}
  ul li{
    list-style: none;
  }
  .input{
    width: 140px;
    height: 40px;
    line-height: 40px;
    padding-left: 10px;
    border-radius: 50px;
    border: 1px solid #ff0000;
    background: #fff;
    position: relative;
    display: flex;
    align-items: center;
  }
  .input input{
    border: none;
    outline: none;
    width: 90%;
    color: #3A79EE;
    height: 30px;
    background-color: #fff;
  }
  .input img{
    position: absolute;
    right: 34px;
    top: 48%;
  }
  .list{
    width: 100px;
    border: 1px solid #7047f7;
    border-radius: 10px;
    overflow: hidden;
    position: absolute;
    top: 50px;
    left: 20px;
    background-color: aquamarine;
  }
  .list ul li{
    width: 100%;
    height: 30px;
    cursor: pointer;
    line-height: 30px;
    padding-left: 10px;
  }
  .list ul li:hover{
    background-color: #cccccc;
  }
</style>

  • 写回答

4条回答 默认 最新

  • 你好!机器人 2022-07-07 20:20
    关注

    你这样写也没问题,你给li一个颜色看有没有生效,先排查是所有样式是不是都不生效

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 7月16日
  • 已采纳回答 7月8日
  • 创建了问题 7月7日

悬赏问题

  • ¥15 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗