zoukankan      html  css  js  c++  java
  • 前端模糊查询

    一般情况下,模糊查询是通过调用后台接口实现的,今天我在项目中,尝试了一下简单的前端模糊查询。

    <el-button class="billButton" type="primary" @click="filterShow">筛选</el-button>
    
    <!--筛选弹出框-->
    <el-dialog :visible.sync="dialogTableVisible" style="text-align: center;">
    			
    	<el-input v-model="filterData" style=" 80%;"></el-input>
    		<el-table  :data="passTable"  border>			
    			<el-table-column label="串码" width="150" prop="QMNO" sortable></el-table-column>
    			<el-table-column label="校验结果" prop="checkMessage"></el-table-column>			
    		</el-table>
    	
    		<span slot="footer" class="dialog-footer">
    			 <el-button @click="dialogTableVisible = false">取消</el-button>
    			 <el-button type="primary"  @click="filterHandler">确定</el-button>
    		</span>
    </el-dialog>
    
    
    //筛选
     filterShow(){
    	this.filterData = ''
    	this.dialogTableVisible = true		    	
    },
    //筛选确定
    filterHandler(){
    	this.dialogTableVisible = false
    	var len = this.passTable.length;
    	var reg = new RegExp(this.filterData);
    	this.passTable.map(item=>{
    		//如果字符串中不包含目标字符会返回-1
    		 if(item.checkMessage.match(reg)){
    			this.passTable2.push(item);
    		 }
    	})
    	this.passTable = this.passTable2
    },
    
    
  • 相关阅读:
    用户交互
    python简介
    maven阿里云镜像setting
    apache虚拟主机的ip用法 包括iis
    apache的虚拟主机配置和指定目录的访问描述(
    apache重定向301 配置,根域名转到www
    前端学习
    一步一步写jQuery插件
    json 和 table控件
    下载相关
  • 原文地址:https://www.cnblogs.com/yinxingen/p/9049512.html
Copyright © 2011-2022 走看看