# ykautocomplete

> A popover javascript plug-in

Latest version **1.0.0** (published 2017-06-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install ykautocomplete
pnpm add ykautocomplete
yarn add ykautocomplete
bun add ykautocomplete
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-06-13 |
| First published | 2017-06-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | yankang |
| Maintainers | yy249357 |
| Keywords | autoComplete |

## Links

- npm: https://www.npmjs.com/package/ykautocomplete
- Repository: https://github.com/yy249357/autoComplete
- Homepage: https://github.com/yy249357/autoComplete#readme
- Issues: https://github.com/yy249357/autoComplete/issues
- npm.io page: https://npm.io/package/ykautocomplete

## Recent versions

- 1.0.0 (latest) — 2017-06-13

## README

autoComplete
======

A javascript plug-in for fuzzy query.

Install
-------
方式一  

* npm install ykAutoComplete  
 
方式二  

* clone the repo: `git clone https://github.com/yy249357/autoComplete.git`.

Example
-----------

Here is a simple example.

**测试数据**
```js
autocomplete("#test", {
    number: 4,
    fuzzy: true,
    srcData: [
        'apple',
        'banana',
        'cherry',
        'dog',
        'eat',
        'frog',
        'grape',
        'orange',
        'lemon',
        'plum',
        'peach'
    ]
})
```

**ajax请求**
```js
    autocomplete('#vcTitle', {
        fuzzy: false, 
        number: 6,
        srcData: function(callback){
            var ret = [], storage = []
            $.ajax({
                type: "post",
                url: "/web/home-msg/fuzzy-query",
                contentType : 'application/json; charset=UTF-8',
                data:JSON.stringify({
                    'iMsgType': $('#iMsgType').val(),
                    'vcTitle': $("#vcTitle").val()
                }),
                cache: false,
                dataType: 'json',
                success: function(res) {
                    var temp = res.data
                    for(var i=0; i<temp.length; ++i){
                        ret.push(temp[i].vcTitle)
                        storage.push(temp[i].vcMsgId)
                    }
                    callback(ret, storage)
                }
            })
        }
    })
```

API Document
--------

说明: 一个页面内始终只有一个弹窗框

**number: 显示的条数**

说明: 默认显示6条 
例:
```
number: 10
```

**fuzzy: 是否开启前端模糊查询**

说明: 默认为开启。如果请求的数据是后端已经模糊查询过的,可以关闭。
例:
```
fuzzy: false
```

**lineHeight: 列表行高** 

说明: 默认为20px
例:
```
lineHeight: 30
```

**width: 搜索结果框宽度**

说明: 默认和input输入框宽度相同
例:
```
width: 200
```

---
_Source: https://npm.io/package/ykautocomplete · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
