小米搜索框

代码有些地方不是很完善 ,可以根据自己需求进行改善

 InsCode - 让你的灵感立刻落地

html 部分

 <div class="app">
        <div class="Prodeuct-big-box">
            <!-- <input type="text" placeholder="红米K60" @focus="GetFocus" @blur="LoseFocus"> -->
            <input type="text" placeholder="红米K60">
            <span>🔍</span>
        </div>
        <div class="Product-list" v-show="isShow">
            <ul>
                <li v-for="(item,index) in list" :key="index">{{item.name}}</li>
            </ul>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el:'.app',
            data:{
                list:[
                    {name:'手机换新'},
                    {name:'小米14'},
                    {name:'小米su7'},
                    {name:'红米K70'},
                    {name:'小米电视'},
                    {name:'小米手表'}
                ],
                isShow:true
            },
            // methods:{
            //     GetFocus(){
            //         this.isShow = true
            //     },
            //     LoseFocus(){
            //         this.isShow = !this.isShow
            //     }
            // }
        })
    
        </script>

css 部分

*{
    margin: 0;
    padding: 0;
    outline: none;
    list-style: none;
}
body{
    height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.Prodeuct-big-box{
    display: flex;
    width: 260px;
    height: 40px;
    padding: 0 0 0 5px;
    box-sizing: border-box;
    border: 1px solid red;
}
.Prodeuct-big-box input{
    width: 210px;
    height: 100%;
    border: none;
    border-right: 1px solid red;
}
.Prodeuct-big-box span{
    display: inline-block;
    width: 50px;
    height: 40px;
    line-height: 40px;
    cursor: pointer;
    font-size: 20px;
    text-align: center;
}
.Prodeuct-big-box span:hover{
    background-color: orange;
}

.Product-list{
    width: 210px;
    padding: 5px;
    border: 1px solid red;
    box-sizing: border-box;
}
.Product-list li{
    padding: 5px;
    cursor: default;
}
.Product-list li:hover{
    background-color: #eee;
}

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值