Giter VIP home page Giter VIP logo

layui_complete's People

Contributors

ringocx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

layui_complete's Issues

支持键盘上下回车选择

非常感谢作者的开发奉献
在使用中有些细节期望补充,比如筛选数据后支持键盘的上下回车键选择
提供参考代码:
image

image

image

##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 }

【疑问】版本不一致

源下载地址上的zip包与github上的版本不是一个同一个版本, 在zip包中,cachetrue的时候会对缓存的数据依据输入的filter创建一个新的数组arr

但是这个数组的内容在$(document).on('click')的时候没有使用到, _config.data[_self.index][_e.index()])取的恒为数据collection中的第一个元素, 可能这里要修复一下。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.