【发布时间】:2020-06-07 22:03:16
【问题描述】:
我使用排序库:https://github.com/clauderic/react-sortable-hoc 我使用基本示例:
import React, {Component} from 'react';
import {render} from 'react-dom';
import {SortableContainer, SortableElement, arrayMove} from 'react-sortable-hoc';
const SortableItem = SortableElement(({value}) => (
<li tabIndex={0}>{value}</li>
));
const SortableList = SortableContainer(({items}) => {
return (
<ul>
{items.map((value, index) => (
<SortableItem key={`item-${value}`} index={index} value={value} />
))}
</ul>
);
});
class SortableComponent extends Component {
state = {
items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'],
};
onSortEnd = ({oldIndex, newIndex}) => {
this.setState(({items}) => ({
items: arrayMove(items, oldIndex, newIndex),
}));
};
render() {
return <SortableList items={this.state.items} onSortEnd={this.onSortEnd} />;
}
}
export default SortableComponent;
但它没有在我的 IE 中唤醒。项目被渲染,但在 keydown 或拖动时没有任何反应。 我正在使用最新版本的库。 我的反应应用程序也呈现在 jquery 基础应用程序的页面中。这可能是问题吗?但仅适用于 IE。不确定是否有东西阻塞了库。
有人遇到过同样的问题吗?
【问题讨论】:
标签: reactjs react-sortable-hoc