广州总部电话:020-85564311
20年
互联网应用服务商
广州总部电话:020-85564311
20年
互联网应用服务商
请输入搜索关键词
知识库 知识库

优网知识库

探索行业前沿,共享知识宝库

告别普通样式!uni-app 8 种高级搜索框源码

发布日期:2026-04-08 09:03:21 浏览次数: 812 来源:雪天前端
推荐语
8款高颜值搜索框源码直接拿,提升小程序颜值与用户体验的利器!

核心内容:
1. 8种主流小程序搜索框样式源码分享
2. 搜索框对用户体验和转化率的关键价值
3. 渐变边框搜索栏等具体实现方案解析
小优 网站建设顾问
专业来源于二十年的积累,用心让我们做到更好!

本文整理 8 款主流小程序搜索框样式,源码可直接使用。文章为雪天前端原创整理,转载需授权,私自搬运必究!






一个精美好看的搜索框,不只是界面上的功能入口,更是提升用户体验的关键细节。它能快速帮用户定位内容,减少操作步骤,降低流失率;高颜值设计让界面更精致高级,提升整体质感与品牌形象;同时强化交互体验,让用户愿意点击、愿意使用,间接提升活跃度与转化率。好看又好用的搜索框,是应用里颜值与效率并存的小而美核心功能。

01


渐变边框搜索栏

经典渐变边框设计,圆角通透感强,右侧渐变搜索按钮,整体简约高级,适配大多数 APP / 商城首页。
<template>
  <view class="search-bar">
    <view class="search-container">
      <image class="search-icon" src="/static/xt-search/scan.png" mode="widthFix"></image>
      <input class="search-input" placeholder="搜索美食/民宿/攻略等" placeholder-style="color:#999" />
      <view class="search-button" @click="doSearch">搜索</view>
    </view>
</view>
</template>

<script>
exportdefault {
    methods: {
      doSearch() {
        console.log("执行第一个搜索")
      }
    }
  }
</script>

<style scoped>
.search-bar {
    background-color#fff;
    border-radius20rpx;
    padding10rpx;
  }
.search-container {
    display: flex;
    align-items: center;
    height72rpx;
    padding06rpx 020rpx;
    border-radius40rpx;
    border3rpx solid transparent;
    backgroundlinear-gradient(#fff#fff) padding-box,
      linear-gradient(90deg, #B1A8E6#9ED5F5#88E7CB) border-box;
  }
.search-icon {
    width32rpx;
    height32rpx;
    margin-right16rpx;
  }
.search-input {
    flex1;
    height100%;
    font-size28rpx;
    color#333;
  }
.search-button {
    padding036rpx;
    height56rpx;
    line-height56rpx;
    border-radius28rpx;
    font-size28rpx;
    color#fff;
    backgroundlinear-gradient(90deg, #63D1E8#7BE8A3);
  }
</style>
文章为雪天前端原创整理,转载需授权,私自搬运必究!

02


城市 + 消息搜索栏

头部导航式搜索框,左侧城市选择、右侧消息角标,适合外卖 / 旅游 / 本地生活类小程序顶部使用。

<template>
  <view class="header-search-bar">
    <view class="city-selector" @click="selectCity">
      <text class="city-text">杭州</text>
      <text class="down-arrow"></text>
    </view>
    <view class="header-search-container">
      <image src="/static/xt-search/searchIcon.png" class="header-search-icon" mode="widthFix"></image>
      <input class="header-search-input" placeholder="雪天前端" placeholder-style="color:#999" />
    </view>
    <view class="message-icon-wrapper" @click="openMessage">
      <image src="/static/xt-search/messageIcon.png" class="message-icon" mode="widthFix"></image>
      <view class="badge">12</view>
    </view>
</view>
</template>

<script>
exportdefault {
    methods: {
      selectCity() {
        console.log("打开城市选择器")
      },
      openMessage() {
        console.log("打开消息列表")
      }
    }
  }
</script>

<style scoped>
.header-search-bar {
    display: flex;
    align-items: center;
    padding20rpx;
    background-color#fef6f6;
    border-radius20rpx;
  }
.city-selector {
    display: flex;
    align-items: center;
    margin-right20rpx;
  }
.city-text {
    font-size32rpx;
    color#333;
    font-weight500;
  }
.down-arrow {
    font-size24rpx;
    color#666;
    margin-left8rpx;
  }
.header-search-container {
    flex1;
    display: flex;
    align-items: center;
    height72rpx;
    padding024rpx;
    border-radius36rpx;
    background-color#fff;
    border2rpx solid #f0e0e0;
  }
.header-search-icon {
    width32rpx;
    height32rpx;
    margin-right16rpx;
  }
.header-search-input {
    flex1;
    height100%;
    font-size28rpx;
    color#333;
  }
.message-icon-wrapper {
    position: relative;
    margin-left20rpx;
  }
.message-icon {
    width60rpx;
    height60rpx;
  }
.badge {
    position: absolute;
    top: -12rpx;
    right: -12rpx;
    min-width32rpx;
    height32rpx;
    line-height32rpx;
    padding08rpx;
    background-color#ff4d4f;
    color#fff;
    font-size20rpx;
    border-radius16rpx;
    text-align: center;
  }
</style>


文章为雪天前端原创整理,转载需授权,私自搬运必究!



03


左侧标题 + 绿色按钮搜索栏

左侧大标题 + 右侧一体化搜索框,绿色按钮醒目,适合工具类、内容类平台首页搜索使用。

<template>
  <view class="third-search-bar">
    <view class="third-title">雪天前端</view>
    <view class="third-search-container">
      <view class="third-search-inner">
        <image class="third-search-icon" src="/static/xt-search/scan.png" mode="widthFix"></image>
        <input class="third-search-input" placeholder="搜索关键字" placeholder-style="color:#999" />
      </view>
      <view class="third-search-btn" @click="thirdSearch">搜索</view>
    </view>
</view>
</template>

<script>
exportdefault {
    methods: {
      thirdSearch() {
        console.log("执行第三个搜索")
      }
    }
  }
</script>

<style scoped>
.third-search-bar {
    display: flex;
    align-items: center;
    padding20rpx;
    background-color#e8f9e8;
    border-radius20rpx;
  }
.third-title {
    font-size48rpx;
    font-weight: bold;
    color#333;
    margin-right24rpx;
  }
.third-search-container {
    flex1;
    display: flex;
    align-items: center;
    height80rpx;
    border-radius40rpx;
    background-color#fff;
    border3rpx solid #333;
    overflow: hidden;
  }
.third-search-inner {
    flex1;
    display: flex;
    align-items: center;
    padding024rpx;
  }
.third-search-icon {
    width36rpx;
    height36rpx;
    margin-right16rpx;
  }
.third-search-input {
    flex1;
    height100%;
    font-size28rpx;
    color#333;
    background: transparent;
  }
.third-search-btn {
    width140rpx;
    height100%;
    line-height80rpx;
    text-align: center;
    font-size32rpx;
    font-weight: bold;
    color#333;
    background-color#89e889;
  }
</style>
文章为雪天前端原创整理,转载需授权,私自搬运必究!

04


黄色边框 + 热门标签搜索栏

暖黄色渐变边框 + 热门标签,视觉吸睛,适合二手市场、活动、优惠类平台使用。 

<template>
  <view class="fourth-search-bar">
    <view class="fourth-search-container">
      <image class="fourth-search-icon" src="/static/xt-search/scan.png" mode="widthFix"></image>
      <input class="fourth-search-input" placeholder="二手市场大降价" placeholder-style="color:#333" />
      <view class="fourth-hot-tag"></view>
      <view class="fourth-search-btn" @click="fourthSearch">搜索</view>
    </view>
</view>
</template>

<script>
exportdefault {
    methods: {
      fourthSearch() {
        console.log("执行搜索")
      }
    }
  }
</script>

<style scoped>
.fourth-search-bar {
    padding20rpx 0;
    background-color#fff;
    border-radius20rpx;
  }
.fourth-search-container {
    display: flex;
    align-items: center;
    height80rpx;
    padding06rpx 024rpx;
    border-radius40rpx;
    backgroundlinear-gradient(#fff#fff) padding-box,
      linear-gradient(90deg, #ffff7f#fff478) border-box;
    border3rpx solid transparent;
  }
.fourth-search-icon {
    width36rpx;
    height36rpx;
    margin-right16rpx;
  }
.fourth-search-input {
    flex1;
    height100%;
    font-size32rpx;
    color#333;
  }
.fourth-hot-tag {
    padding4rpx 12rpx;
    margin016rpx;
    font-size24rpx;
    color#ff6600;
    background-color#fff5e6;
    border-radius8rpx;
  }
.fourth-search-btn {
    width140rpx;
    height64rpx;
    line-height64rpx;
    text-align: center;
    font-size32rpx;
    font-weight: bold;
    color#333;
    backgroundlinear-gradient(90deg, #fff2cc#ffeb99);
    border-radius32rpx;
  }
</style>
文章为雪天前端原创整理,转载需授权,私自搬运必究!

05


橙色边框 + 相机图标搜索栏

复古橙色边框 + 相机识图按钮,橙色搜索图标,适合电商、数码、图片搜索类场景。

<template>
  <view class="fifth-search-bar">
    <view class="fifth-search-container">
      <image class="fifth-search-icon" src="/static/xt-search/scan.png" mode="widthFix"></image>
      <input class="fifth-search-input" placeholder="iphone17 plus抢购" placeholder-style="color:#999" />
      <image class="fifth-camera-icon" src="/static/xt-search/camera.png" mode="widthFix"></image>
      <view class="fifth-search-btn" @click="fifthSearch">
        <image src="/static/xt-search/search-orange.png" mode="widthFix"></image>
      </view>
    </view>
</view>
</template>

<script>
exportdefault {
    methods: {
      fifthSearch() {
        console.log("执行第五个搜索")
      }
    }
  }
</script>

<style scoped>
.fifth-search-bar {
    padding20rpx;
    background-color#fff;
    border-radius20rpx;
  }
.fifth-search-container {
    display: flex;
    align-items: center;
    height80rpx;
    padding06rpx 024rpx;
    border-radius40rpx;
    background-color#fff;
    border3rpx solid #cc8866;
  }
.fifth-search-icon {
    width36rpx;
    height36rpx;
    margin-right16rpx;
  }
.fifth-search-input {
    flex1;
    height100%;
    font-size32rpx;
    color#999;
  }
.fifth-camera-icon {
    width60rpx;
    height60rpx;
    margin020rpx;
  }
.fifth-search-btn {
    width90rpx;
    height70rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    backgroundlinear-gradient(90deg, #ff7744#ff5522);
    border-radius40rpx;
  }
.fifth-search-btnimage {
    width40rpx;
    height40rpx;
  }
</style>


06


浅蓝渐变 + 登录按钮搜索栏

清爽浅蓝色渐变边框,右侧用户登录按钮,适合商城、服务类小程序未登录状态使用。

<template>
  <view class="sixth-search-bar">
    <view class="sixth-search-container">
      <image class="sixth-search-icon" src="/static/xt-search/scan.png" mode="widthFix"></image>
      <input class="sixth-search-input" placeholder="搜索商品或店铺名" placeholder-style="color:#999" />
    </view>
    <view class="sixth-login-btn" @click="sixthLogin">
      <image src="/static/xt-search/user.png" mode="widthFix"></image>
      <text>登录</text>
    </view>
</view>
</template>

<script>
exportdefault {
    methods: {
      sixthLogin() {
        console.log("打开登录弹窗")
      }
    }
  }
</script>

<style scoped>
.sixth-search-bar {
    display: flex;
    align-items: center;
    padding20rpx;
    background-color#fff;
    border-radius20rpx;
  }
.sixth-search-container {
    flex1;
    display: flex;
    align-items: center;
    height80rpx;
    padding024rpx;
    border-radius40rpx;
    backgroundlinear-gradient(#fff#fff) padding-box,
      linear-gradient(90deg, #e6f2ff#f0f8ff) border-box;
    border3rpx solid transparent;
  }
.sixth-search-icon {
    width36rpx;
    height36rpx;
    margin-right16rpx;
  }
.sixth-search-input {
    flex1;
    height100%;
    font-size32rpx;
    color#333;
  }
.sixth-login-btn {
    display: flex;
    align-items: center;
    margin-left20rpx;
    font-size32rpx;
    color#4488dd;
  }
.sixth-login-btnimage {
    width40rpx;
    height40rpx;
    margin-right8rpx;
  }
</style>
文章为雪天前端原创整理,转载需授权,私自搬运必究!

07


绿色背景 + 双图标搜索栏

墨绿色主题背景,左侧菜单 + 右侧消息角标,中间麦克风语音搜索,高级感拉满。

<template>
  <view class="seventh-search-bar">
    <view class="seventh-left-icon" @click="seventhLeftClick">
      <image src="/static/xt-search/menu.png" mode="widthFix"></image>
    </view>
    <view class="seventh-search-container">
      <image class="seventh-search-icon" src="/static/xt-search/searchIcon.png" mode="widthFix"></image>
      <input class="seventh-search-input" placeholder="雪天前端" placeholder-style="color:#999" />
      <view class="seventh-mic-icon" @click="seventhMicClick">
        <image src="/static/xt-search/mic.png" mode="widthFix"></image>
      </view>
    </view>
    <view class="seventh-right-icon" @click="seventhRightClick">
      <image src="/static/xt-search/message-filled.png" mode="widthFix"></image>
      <view class="seventh-badge">7</view>
    </view>
</view>
</template>

<script>
exportdefault {
    methods: {
      seventhLeftClick() {
        console.log("第七个左侧图标点击")
      },
      seventhMicClick() {
        console.log("第七个麦克风点击")
      },
      seventhRightClick() {
        console.log("第七个消息图标点击")
      }
    }
  }
</script>

<style scoped>
.seventh-search-bar {
    display: flex;
    align-items: center;
    padding20rpx;
    background-color#009688;
    border-radius20rpx;
  }
.seventh-left-icon {
    width60rpx;
    height60rpx;
    margin-right20rpx;
  }
.seventh-left-iconimage {
    width100%;
    height100%;
  }
.seventh-search-container {
    flex1;
    display: flex;
    align-items: center;
    height80rpx;
    padding024rpx;
    border-radius40rpx;
    background-color#fff;
  }
.seventh-search-icon {
    width36rpx;
    height36rpx;
    margin-right16rpx;
  }
.seventh-search-input {
    flex1;
    height100%;
    font-size32rpx;
    color#333;
  }
.seventh-mic-icon {
    width40rpx;
    height40rpx;
    margin-left20rpx;
  }
.seventh-mic-iconimage {
    width100%;
    height100%;
  }
.seventh-right-icon {
    position: relative;
    width60rpx;
    height60rpx;
    margin-left20rpx;
  }
.seventh-right-iconimage {
    width100%;
    height100%;
  }
.seventh-badge {
    position: absolute;
    top: -10rpx;
    right: -10rpx;
    width36rpx;
    height36rpx;
    line-height36rpx;
    text-align: center;
    background-color#ff4d4f;
    color#fff;
    font-size20rpx;
    border-radius50%;
  }
</style>
文章为雪天前端原创整理,转载需授权,私自搬运必究!

08


浅绿色背景 + 品牌 LOGO 搜索栏

清新绿色背景,左侧品牌 LOGO,右侧扫描按钮,品牌化极强,适合企业官网、品牌类小程序。

<template>
  <view class="eighth-search-bar">
    <view class="eighth-brand">
      <image class="eighth-brand-icon" src="/static/xt-search/user.png" mode="widthFix"></image>
      <text class="eighth-brand-text">snow</text>
    </view>
    <view class="eighth-search-container">
      <image class="eighth-search-icon" src="/static/xt-search/searchIcon.png" mode="widthFix"></image>
      <input class="eighth-search-input" placeholder="搜索雪天前端~" placeholder-style="color:#999" />
    </view>
    <view class="eighth-menu-icon" @click="eighthMenuClick">
      <image src="/static/xt-search/scan.png" mode="widthFix"></image>
    </view>
</view>
</template>

<script>
exportdefault {
    methods: {
      eighthMenuClick() {
        console.log("第八个菜单图标点击")
      }
    }
  }
</script>

<style scoped>
.eighth-search-bar {
    display: flex;
    align-items: center;
    padding20rpx;
    background-color#d4f4c4;
    border-radius20rpx;
  }
.eighth-brand {
    display: flex;
    align-items: center;
    margin-right20rpx;
  }
.eighth-brand-icon {
    width80rpx;
    height80rpx;
    margin-right12rpx;
  }
.eighth-brand-text {
    font-size40rpx;
    font-weight: bold;
    color#222;
  }
.eighth-search-container {
    flex1;
    display: flex;
    align-items: center;
    height80rpx;
    padding024rpx;
    border-radius40rpx;
    background-colorrgba(255, 255, 255, 0.7);
  }
.eighth-search-icon {
    width36rpx;
    height36rpx;
    margin-right16rpx;
  }
.eighth-search-input {
    flex1;
    height100%;
    font-size32rpx;
    color#333;
    background: transparent;
  }
.eighth-menu-icon {
    width60rpx;
    height60rpx;
    margin-left20rpx;
  }
.eighth-menu-iconimage {
    width100%;
    height100%;
  }
</style>
打码不易,如有帮助,可以求大佬一个免费的关注吗,非常感谢!
文章为雪天前端原创整理,转载需授权,私自搬运必究!


优网科技,优秀企业首选的互联网供应服务商

优网科技秉承"专业团队、品质服务" 的经营理念,诚信务实的服务了近万家客户,成为众多世界500强、集团和上市公司的长期合作伙伴!

优网科技成立于2001年,擅长网站建设、网站与各类业务系统深度整合,致力于提供完善的企业互联网解决方案。优网科技提供PC端网站建设(品牌展示型、官方门户型、营销商务型、电子商务型、信息门户型、微信小程序定制开发、移动端应用(手机站APP开发)、微信定制开发(微信官网、微信商城、企业微信)等一系列互联网应用服务。


我要投稿

姓名

文章链接

提交即表示你已阅读并同意《个人信息保护声明》

专属顾问 专属顾问
扫码咨询您的优网专属顾问!
专属顾问
马上咨询