ringocx / layui_complete Goto Github PK
View Code? Open in Web Editor NEWLAYUI扩展autocomplete插件
LAYUI扩展autocomplete插件
例如一个input中,补全完第一个,然后打个逗号 再次提示补全呢?
如题,动态插入的DOM元素无法绑定。开发者有计划添加吗
因为数据是通过API读取的,所以要加上token在header里面,请问有这个选项吗?
1.指定至少输入多个个字符后触发请求
2.手动删除文本的时候要触发事件
非常感谢作者的开发奉献
在使用中有些细节期望补充,比如筛选数据后支持键盘的上下回车键选择
提供参考代码:
##js-part-1
layout: ['<dd class="{{d.class}}" data-index="{{d.index}}">{{d.text}}</dd>'].join(''),
##js-part-2
_config.temp_data.push(e), _list.push(laytpl(_config.layout).render({ class:i==0?'active':'', index: i, text: laytpl(_config.template_txt).render(e) }));
##js-part-3
on('input keydown', function (e) { if ([38, 40, 13].indexOf(e.keyCode) > -1) { var _tdom = (_dom.find('.active')) console.log(_tdom) if (_tdom && _tdom.length > 0) { if (e.keyCode == 38)//up { var _tprev = _tdom.prev('dd'); if (_tprev && _tprev.length > 0) { _tdom[0].classList.remove('active'); _tprev[0].classList.add('active'); } return false; } if (e.keyCode == 40) {//down var _tnext = _tdom.next('dd'); if (_tnext && _tnext.length > 0) { _tdom[0].classList.remove('active'); _tnext[0].classList.add('active'); } return false; } if (e.keyCode == 13) { var curr_data = _config.temp_data[_tdom[0].dataset.index] _elem.val(laytpl(_config.template_val).render(curr_data)), _config.onselect == undefined || _config.onselect(curr_data) _container.removeClass(container_focus); return false; } } } })
##css
.layui-form-autocomplete dl dd:hover,.layui-form-autocomplete .active { background-color: #f2f2f2 }
查询无数据的时候应该在输入栏下方提示“无匹配结果”
另外,需要自定义post时提交的参数。可以实现么
如题:数据已经在本地无需去服务端请求
源下载地址上的zip包与github上的版本不是一个同一个版本, 在zip包中,cache
为true
的时候会对缓存的数据依据输入的filter
创建一个新的数组arr
。
但是这个数组的内容在$(document).on('click')
的时候没有使用到, _config.data[_self.index][_e.index()])
取的恒为数据collection中的第一个元素, 可能这里要修复一下。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.