vue仿百度联想

功能:输入关键字弹出联想。
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
    <link rel="stylesheet" href="./idex.css">
    <script src = "./jquery.js"></script>
  <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <div class="logo">
            <img src="https://www.baidu.com/img/bd_logo1.png?where=super" title="点击一下了解更多">
        </div>
        <div class="search-box">
            <span class="search-area">
                    <input type="text"
                      maxlength="100"
                      v-model = "inputVal"
                      @focus = "() => inputFpcus = true"
                      @blur = "() => inputFpcus = false"
                    >

                <span class="icon icon-paizhao"></span>
            </span>
            <span class="search-btn">百度一下</span>
            
        </div>
        <ul class="search-list"
            v-show = "inputFpcus && searchResList.length"    
        >
            <li
              v-for = "res in searchResList"
              :key = "res"
            >
           {{ res }}
        </ul>
        </div>
    </div>
    

    <script>
        const vm = new Vue({
            el:'#app',

            data:{
                inputFpcus:false,
                inputVal :'',
                searchResList:[]

            },
            methods:{
                searchRes(res){
                    this.searchResList = res.s;
                }
            },
            watch:{
                inputVal(){
                    $.ajax({
                        dataType:'jsonP',
                        url:' https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su',
                        data:{
                            wd:this.inputVal,
                            cb:'vm.searchRes',
                        }
                    })

                }
            }

        })
    </script>
</body>
</html>
* {
    padding: 0;
    margin: 0;
  }
  
  li {
    list-style: none;
  }
  
  @font-face {
    font-family: 'iconfont';  /* project id 1511900 */
    src: url('./font/iconfont.eot');
    src: url('./font/iconfont.eot?#iefix') format('embedded-opentype'),
    url('./font/iconfont.woff2') format('woff2'),
    url('./font/iconfont.woff') format('woff'),
    url('./font/iconfont') format('truetype'),
    url('./font/iconfont.svg#iconfont') format('svg');
  }
  
  .icon {
    font-family: 'iconfont' !important;
  }
  
  .icon-paizhao:before {
    content: "\e66f";
  }
  
  #app {
    width: 638px;
    margin: 100px auto;
  }
  
  .logo {
    width: 270px;
    height: 129px;
    margin: 0 auto;
  }
  
  .logo img{
    width: 100%;
    height: 100%;
    cursor: pointer;
  }
  
  .search-box {
    display: flex;
    margin-top: 40px;
  }
  
  .search-area {
    position: relative;
    display: inline-block;
    width: 536px;
    height: 40px;
    line-height: 40px;
  }
  
  .search-area  input {
    width: 480px;
    height: 20px;
    padding: 9px 48px 9px 7px;
    font-size: 16px;
    border: 1px solid #b8b8b8;
    border-bottom: 1px solid #ccc;
    vertical-align: top;
    border-right: none;
    outline: none;
  }
  
  .search-area  input:focus {
    border-color: #38f;
    /* border-bottom-color: transparent; */
  }
  
  .search-area .icon-paizhao {
    position: absolute;
    top: 50%;
    margin-top: -8px;
    right: 11px;
    font-size: 22px;
    line-height: 16px;
    cursor: pointer;
  }
  
  .search-btn {
    width: 102px;
    height: 40px;
    line-height: 40px;
    background-color: #38f;
    color: #fff;
    font-size: 16px;
    text-align: center;
  }
  
  .search-btn:hover {
    height: 39px;
    background-color: #317ef3;
    border-bottom: 1px solid #2868c8;
    box-shadow: 1px 1px 1px #ccc;
  }
  
  .search-list {
    position: relative;
    top: -1px;
    width: 535px;
    border: 1px solid #ccc;
    padding-top: 1px;
    box-shadow: 1px 1px 3px #ededed;
    z-index: 1;
  }
  
  .search-list li {
    width: 519px;
    height: 22px;
    line-height: 22px;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 14px;
    cursor: default;
  }
  
  .search-list li:hover {
    background-color: #f0f0f0;
  
  }     
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据提供的引用内容,我无法直接回答你关于Vue仿支付宝年度账单的问题。引用中提到了使用支付宝模块进行拉起支付宝的操作,而引用中提到了月份显示的布局由接口StickyListHeadersAdapter提供的getHeaderView。这些内容与Vue仿支付宝年度账单的实现没有直接关联。 如果你想了解如何使用Vue来实现仿支付宝年度账单的功能,我可以为你提供一些思路和步骤: 1. 创建Vue项目:首先,你需要创建一个Vue项目。你可以使用Vue CLI来快速搭建一个基本的Vue项目。 2. 设计页面布局:根据支付宝年度账单的样式,设计相应的页面布局。可以使用Vue的组件来构建页面结构,并使用CSS样式进行美化。 3. 获取数据:通过接口或模拟数据,获取支付宝年度账单的数据。你可以使用Vue的生命周期钩子函数来在页面加载时获取数据,并将数据存储在Vue的data属性中。 4. 渲染数据:将获取到的数据渲染到页面上。你可以使用Vue的指令和插值表达式来动态地将数据绑定到页面元素上。 5. 实现交互功能:根据支付宝年度账单的功能需求,实现相应的交互功能。例如,点击某个账单项时展开或收起详细信息,切换不同的账单类型等。你可以使用Vue的事件处理和条件渲染来实现这些功能。 6. 部署和测试:完成开发后,将项目部署到服务器或本地环境,并进行测试。确保功能正常运行,并进行必要的调试和优化。 请注意,以上步骤仅为一种实现Vue仿支付宝年度账单的思路,具体的实现方式可能因项目需求和个人偏好而有所不同。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值