use*_*352 2 javascript drag-and-drop reactjs higher-order-components react-sortable-hoc
JSFiddle:https ://jsfiddle.net/40vpaLj5/
我用谷歌搜索了一些问题,我发现唯一消失的相关问题是当人们在模态上使用它时,他们谈到设置 z-index 来修复它。反正我试过了还是什么都没有。我怎样才能解决这个问题?
import React from 'react';
import PlaylistPages from './PlaylistPages';
class PlaylistSortableComponent extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
test: [
'1','2', '3', '4'
]
}
}
render() {
return (
<PlaylistPages pages={this.state.test} style={{zIndex: 999999}} />
);
}
}
const PlaylistPages = SortableContainer(({pages}) => {
return (
<div>
{
pages.map((page, index) =>
<PlaylistPage key={index} page={page} style={{zIndex: 99999999}} />
)}
</div>
);
});
const PlaylistPage = SortableElement(({page}) => {
return (
<div style={{zIndex: 99999999}} >{page}</div>
);
});
Run Code Online (Sandbox Code Playgroud)
每个人都sortableElement应该有自己的index道具:
<PlaylistPage key={index} index={index} page={page} style={{zIndex: 99999999}} />
Run Code Online (Sandbox Code Playgroud)
这是对 jsfiddle 的更新:https ://jsfiddle.net/40vpaLj5/1/
| 归档时间: |
|
| 查看次数: |
2974 次 |
| 最近记录: |