handsontable输入中文第一个字母丢失问题
首先查看 版本是否为最新版本 ,官网说 V14.4已经修复了问题github上有解决方法https://github.com/handsontable/handsontable/issues/10773#issuecomment-1940713298加上这个参数:imeFastEdittrue另外说一下怎么重新实现将自带的功能(删除行/删除列等等)放到submenu中首先自定义的二级菜单(submenu) 需要和外层定义的key 相同 并以 外层key:子级key的命名方式来实现,在内部必须使用callback 来实现原有的功能 (不用自己完全实现)关键点 直接使用 hot.alter(功能key名称, rowIndex, amount)示例items: { custom: { name: 行列操作, submenu: { items: [ { key: custom:remove_row, name: 删除行, callback() { const hot getHotInstance() if (!hot) return const selected hot.getSelectedLast() if (!selected) return const [startRow, , endRow] selected const rowIndex Math.min(startRow, endRow) const amount Math.abs(endRow - startRow) 1 hot.alter(remove_row, rowIndex, amount) } }, { key: custom:remove_col, name: 删除列, callback() { const hot getHotInstance() if (!hot) return const selected hot.getSelectedLast() if (!selected) return const [, startCol, , endCol] selected const colIndex Math.min(startCol, endCol) const amount Math.abs(endCol - startCol) 1 hot.alter(remove_col, colIndex, amount) } }, { key: sep1, name: --------- }, { key: custom:col_left, name: 左侧插入列, callback() { const hot getHotInstance() if (!hot) return const selected hot.getSelectedLast() if (!selected) return const [, startCol, , endCol] selected const colIndex Math.min(startCol, endCol) hot.alter(insert_col_start, colIndex, 1) } }, { key: custom:col_right, name: 右侧插入列, callback() { const hot getHotInstance() if (!hot) return const selected hot.getSelectedLast() if (!selected) return const [, startCol, , endCol] selected const colIndex Math.max(startCol, endCol) 1 hot.alter(insert_col_start, colIndex, 1) } }, { key: custom:row_above, name: 上方插入行, callback() { const hot getHotInstance() if (!hot) return const selected hot.getSelectedLast() if (!selected) return const [startRow, , endRow] selected const rowIndex Math.min(startRow, endRow) hot.alter(insert_row_above, rowIndex, 1) } }, { key: custom:row_below, name: 下方插入行, callback() { const hot getHotInstance() if (!hot) return const selected hot.getSelectedLast() if (!selected) return const [startRow, , endRow] selected const rowIndex Math.max(startRow, endRow) hot.alter(insert_row_below, rowIndex, 1) } } ] } }, } function getHotInstance(): Handsontable | null { return (hotTable.value?.hotInstance as Handsontable) ?? null }
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2550488.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!