This article example shares the specific code of Vue+Vant to implement the top search bar for your reference. The specific content is as follows Search bar component source code (SearchBar.vue)<template> <section class="city-search"> <van-icon class="search-icon" name="search" /> <input placeholder="Enter the search keyword here" v-model="KeyWord"> <van-icon class="clear-icon" name="clear" v-show="KeyWord" @click="clearSearchInput" /> </section> </template> <script> export default { data() { return { KeyWord: '', } }, methods: { clearSearchInput() { this.KeyWord = ''; } } } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style> .city-search { background-color: #F7F8FA; display: flex; justify-content: flex-start; align-items: center; height: 2.3rem; width: 94vw; margin: 2vw 4vw; border-radius: 8px; } .search-icon { margin-left: 5px; } input { margin: 0 1.5vw; background-color: #F7F8FA; border: 0px; font-size: 14px; flex: 1 } .clear-icon { color: #999;} </style> Other components rely on reference retrieval componentsHome page reference search component: <template> <div> <search></search> Home</div> </template> <script> import Search from '@/components/SearchBar' export default { name: "home", components: 'search': Search, }, } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style> </style> Effect screenshots: 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:
|
<<: Solution to the problem of MySQL thread in Opening tables
>>: Detailed explanation of how to install the system on VMware workstation 14 pro (virtual machine)
Table of contents Previous words Synchronous and ...
Introduction: This article takes the sample proje...
Overview The framework diagram of this article is...
Error message: Job for mysqld.service failed beca...
the term: 1. VM: Virtual Machine step: 1. Downloa...
Calculation of the box model <br />Margin + ...
This article mainly introduces the process of imp...
1: Tag selector The tag selector is used for all ...
Form submission code 1. Source code analysis <...
MySQL storage engine overview What is a storage e...
When we check the source code of many websites, w...
In fact, many companies have functions similar to...
binlog is a binary log file, which records all my...
The error is as follows: Uncaught TypeError: Cann...
Implement Nginx load balancing based on Docker ne...