更新记录
2.0(2023-05-19)
增加附带框架
1.0(2023-05-19)
初始化带历史记录搜索栏
查看更多
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 3.7.0 app-vue app-nvue |
√ |
√ |
√ |
√ |
√ |
√ |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
√ |
√ |
√ |
√ |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
√ |
带搜索历史搜索栏搜索框使用方法, 使用简单便利
HTML代码部分
<template>
<view class="content">
<view style="margin-top: 16px;">
<!-- keyStr: 设置存储key hisClick: 设置历史事件 searchClick:设置搜索事件 -->
<CCSearchHisView keyStr="productHisArr" searchPlaceHolder="请输入产品名称、关键字" @hisClick="selHisClick"
@searchClick="goSearchClick"></CCSearchHisView>
</view>
</view>
</template>
JS代码 (引入组件 填充数据)
<script>
import CCSearchHisView from '@/components/CCSearchHisView.vue';
export default {
components: {
CCSearchHisView
},
data() {
return {
title: 'Hello'
}
},
() {
},
methods: {
selHisClick(item) {
console.log('选择的值 = ' + item);
uni.navigateTo({
url: '/pages/index/search?name=' + item
})
},
goSearchClick(item) {
uni.navigateTo({
url: '/pages/index/search?name=' + item
})
},
}
}
</script>
CSS
<style scoped>
page {
background-color: '#F6F7FA' !important;
}
.content {
display: flex;
flex-direction: column;
background-color: #F6F7FA;
height: 100vh;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>