直接上代码
HTML视图层代码
<template>
<!-- 模糊查询 + 节流 + 高亮 -->
<div>
<input
type="text"
placehold="请输入id进行查询"
v-model="inputValue"
ref="input"
@keyup="goSearch"
/>
<!-- 这里v-show比v-if省性能 -->
<div
class="conten"
v-show="isShow"
>
<div
class="contenlist"
v-for="(item,index) in list"
:key="index"
>
<!-- <span>{
{item.id}}</span> -->
<!-- <span>{
{item.name}}</span> -->
<!-- <span>{
{item.time}}</span> -->
<span v-html="item.id"></span>
<span v-html="item.name"></span>
<span v-html="item.time"></span>
</div>
</div>
</template>
js数据逻辑层代码:
<script>
// import _ from 'lodash'
export default {
data () {
return {
inputValue: "",
isShow: false,
statu: true,
dataList: [
{
id: "9527", name: "刘一", time: "2020-07-10" },
{
id: "9528", name