zoukankan      html  css  js  c++  java
  • mint-ui 输入框按下按键执行查询

    环境:vue、mint-ui

    功能:一个输入框,按下按键之后就执行某个功能。

    截图:一个输入框

    输入框html:

    <mt-search v-model="query" cancel-text="" placeholder="提取码">   // mt-search 
    基本函数:
    debounce (func, delay) {
          let timer
          return function (...args) {
            if (timer) {
              clearTimeout(timer)
            }
            timer = setTimeout(() => {
              func.apply(this, args)
            }, delay)
          }
        }

    查询函数:

    getData () {
      console.log('执行查询。。。。。。')
    },

    主要函数:

    1 created() {
    2     this.$watch('query', this.debounce(newQuery => {
    3       if (newQuery) {
    4         setTimeout(() => {
    5           this.getData()
    6         }, 20)
    7       }
    8     }, 200))
    9   },
     
     
  • 相关阅读:
    网络抓包工具使用
    JAVA 原子操作类
    guava collection/cache初探
    MiniGUI
    Cookie
    System V IPC
    SQLite交叉编译
    NCurses交叉编译
    双向循环链表
    VMware安装Windows Server 2008
  • 原文地址:https://www.cnblogs.com/shuangzikun/p/taotao_vue_mt-search.html
Copyright © 2011-2022 走看看