当前位置:网站首页>Wechat applet association search
Wechat applet association search
2022-06-27 18:23:00 【When you're lonely, the dog stays with you】
wxml
<view style="width: 100%;height: 100rpx; background-color: green;display: flex;justify-content:center;align-items: center;">
<input type="text" placeholder=" Search for " bindinput="search" style="width: 560rpx;height:60rpx;background-color:white;"/>
</view>
<view>
<block wx:for="{
{list}}" wx:key="key">
<view>
{
{item}}
</view>
</block>
</view>js
// pages/search/search.js
Page({
/**
* Initial data of the page
*/
data: {
arr:['iphone11','iphone12','iphone13','indao'],
list:[],
timer:null,
},
search(res){
clearTimeout(this.data.timer);
this.data.timer = setTimeout(()=>{
let value = res.detail.value;
if(value=='')
{
this.setData({list:[]})
}
let search = this.data.arr;
let reg = new RegExp(value,'i')
let list = [];
list = search.filter((item,key)=>{
return reg.test(item)
})
this.setData({list:list})
console.log(list)
},800)
},
})
边栏推荐
- d3dx9_ How to repair 33.dll? d3dx9_ What if 33.dll is lost?
- Anfulai embedded weekly report (issue 252): February 7, 2022 to February 13, 2022
- Advanced learning of MySQL -- Application -- Optimization of other SQL statements
- WOx WPM installing the Youdao plug-in
- Offline disk group
- [UVM foundation] UVM_ Is in agent_ Active variable definition
- Analysis of shardingsphere core source code
- [JS reverse hundreds of examples] I love to solve 2022 Spring Festival problems and receive red envelopes
- [the way of programmer training] - 3 Character count statistics
- TP5 restrict access frequency
猜你喜欢

428 binary tree (501. mode in binary search tree, 701. insert operation in binary search tree, 450. delete node in binary search tree, 669. prune binary search tree)

DOM object in JS

如何制作登录界面

Use pyinstaller to package py files into exe. Precautions and error typeerror:_ get_ sysconfigdata_ name() missing 1...‘ check_ Solutions to exists'

428-二叉树(501.二叉搜索树中的众数、701.二叉搜索树中的插入操作、450.删除二叉搜索树中的节点、669. 修剪二叉搜索树)

d3dx9_ 39.dll how to repair -d3dx9_ 39.dll missing file download

Asemi rectifier bridge kbp210 parameters, kbp210 specifications, kbp210 dimensions

Optimal binary search tree

CDH cluster installation

Asemi rectifier bridge kbp310 function pin diagram
随机推荐
Oracle concept II
Wechat applet map displays the current position with annotation
Openssf security plan: SBOM will drive software supply chain security
Leetcode 704. Binary search
Byte + Google super full kotlin learning King fried notes! Kotlin introductory tutorial + Advanced kotlin enhanced actual combat (with demo)
[fxcg] today's market analysis
09 route guard authenticates URL
06. First introduction to express
Application of scaleflux CSD 2000 in Ctrip
About redis master-slave replication
写在eclipse里面,与数据库连接查询之后的问题
The power of code refactoring: how to measure the success of refactoring
(POJ - 1847) tram (shortest circuit)
d3dx9_ 39.dll how to repair -d3dx9_ 39.dll missing file download
[Tang Laoshi] C -- encapsulation: member method
Popularization of MCU IO port: detailed explanation of push-pull output and open drain output
Use lamda expression and stream flow to traverse map and list
Part 30 supplement (30) ECMAScript object
Teach you to use elastic search: run the first hello world search command
Hospital reservation and registration system - system structure