1.3K Star 6.3K Fork 2.2K

GVPKarson / FastAdmin

 / 详情

表格无刷新行内编辑 使用tpye=number 会异常 导致弹出框偏离原本位置

待办的
创建于  
2022-09-18 16:41

Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection

将这里 public\assets\addons\editable\js\bootstrap-editable.min.js 中的

setCursorPosition:function(a,b){if(a.setSelectionRange)a.setSelectionRange(b,b);else if(a.createTextRange){var c=a.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",b),c.select()}}

替换为

setCursorPosition:function(a, b) {if (a.setSelectionRange) {try{a.setSelectionRange(b, b)}catch(error){a.setSelectionRange=false}} else if (a.createTextRange) {var c = a.createTextRange();c.collapse(!0), c.moveEnd('character', b), c.moveStart('character', b), c.select();}if(!a.setSelectionRange){a.focus();}}

说明:因为在input标签用了type="number", 导致报错;
从chrome 33版本开始, chrome浏览器只支持获取type为text, search, URL, tel and password的input元素的selectionStart, selectionEnd 和 setSelectionRange 属性, 在其余类型中尝试获取这些属性chrome会提示错误。

评论 (0)

田诚诚 创建了任务
田诚诚 修改了描述
展开全部操作日志

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(1)
1849470 bqldragon 1578961075
PHP
1
https://gitee.com/karson/fastadmin.git
git@gitee.com:karson/fastadmin.git
karson
fastadmin
FastAdmin

搜索帮助