WeChat applet implements search box function

WeChat applet implements search box function

This article example shares the specific code for the WeChat applet to implement the search box function for your reference. The specific content is as follows

Effect:

wxml file:

<view class="search_input" >
        <navigator url="/pages/search/search" open-type="navigate" class="navigator">
       <text class="iconfont icon-guanbi"></text> Search</navigator>
</view>

The icon style needs to be imported into text, here we use iconfont
url is the page to be redirected

.search_input {
  height: 90rpx;
  background-color: #eb4450;
  padding: 10rpx;
} 
.search_input .navigator{
  background-color: #fff;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 15rpx;
  color: #999;
  font-size: 32rpx;
}

In .js:

If the component references the global style, you need to add the following attributes

options:{
      addGlobalClass:true,
  },

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • WeChat applet implements search box function and pitfalls
  • WeChat applet search box style and jump to the search page (applet search function)
  • WeChat mini program imitates Taobao's hot search words in the search box
  • WeChat applet search box component code example
  • WeChat applet implements top search box

<<:  What the website needs most is to improve the experience of the target user group

>>:  Web Design TabIndex Element

Recommend

Design theory: people-oriented design concept

<br />When thoughts were divided into East a...

Detailed explanation of the Docker deployment tutorial for Jenkins beginners

This article deploys Jenkins+Maven+SVN+Tomcat thr...

An example of the difference between the id and name attributes in input

I have been making websites for a long time, but I...

HTML head tag detailed introduction

There are many tags and elements in the HTML head ...

SQL implementation of LeetCode (175. Joining two tables)

[LeetCode] 175.Combine Two Tables Table: Person +...

Docker Gitlab+Jenkins+Harbor builds a persistent platform operation

CI/CD Overview CI workflow design Git code versio...

MySQL tutorial DML data manipulation language example detailed explanation

Table of contents 1. Data Manipulation Language (...

Vue implements a simple magnifying glass effect

This article example shares the specific code of ...

Native JS to implement sharing sidebar

This article shares a sharing sidebar implemented...

How to create WeChat games with CocosCreator

Table of contents 1. Download WeChat developer to...

How to filter out duplicate data when inserting large amounts of data into MySQL

Table of contents 1. Discover the problem 2. Dele...

How to prevent users from copying web page content using pure CSS

Preface When I was typing my own personal blog, I...

HTML+CSS to create heartbeat special effects

Today we are going to create a simple heartbeat e...