久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

Vue+Vant實現頂部搜索欄

瀏覽:2日期:2022-09-29 08:15:01

本文實例為大家分享了Vue+Vant實現頂部搜索欄的具體代碼,供大家參考,具體內容如下

搜索欄組件源碼(SearchBar.vue)

<template> <section class='city-search'> <van-icon name='search' /> <input placeholder='在此輸入檢索關鍵字' v-model='KeyWord'> <van-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>其他組件依賴引用檢索組件

首頁引用搜索組件:

<template> <div> <search></search>首頁 </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>

效果截圖:

Vue+Vant實現頂部搜索欄

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Vue
相關文章:
主站蜘蛛池模板: 平邑县| 县级市| 松滋市| 洪江市| 姜堰市| 滦南县| 永顺县| 双柏县| 惠水县| 辽中县| 和龙市| 黄平县| 辽阳县| 泰和县| 资源县| 精河县| 五原县| 多伦县| 卓尼县| 勐海县| 林周县| 平昌县| 万安县| 西安市| 临夏县| 女性| 武宣县| 板桥市| 杨浦区| 信阳市| 洛阳市| 诸城市| 汕尾市| 万全县| 哈尔滨市| 原平市| 云南省| 湖口县| 甘孜| 商丘市| 吴堡县|