Foveluy / Dragact

a dragger layout system with React style .
MIT License
764 stars 188 forks source link

在ie11浏览器上控制台报错 #28

Open azz1123 opened 6 years ago

azz1123 commented 6 years ago

The above error occurred in one of your React components: in div (at Dragact.js:43) in Unknown in Unknown in div in Unknown (at Dragact.js:27) in Unknown (at App.js:48) in div (at App.js:35) in Unknown (at index.js:7)

Consider adding an error boundary to your tree to customize error handling behavior. Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

'use strict'
import React from 'react';

import {Dragact} from 'dragact'

import styles from './Dragact.scss';

class DragactDemo extends React.Component {
  constructor(props) {
    super(props);

  }

  getblockStyle = (isDragging) => {
    console.log("isDragging", isDragging)
    return {
      background: isDragging ? '#ccc' : 'wheat'
    }
  }

  getLayout = (item, provided) => {
    console.log('item', item, provided)
  };

  render() {
    return (
      <Dragact
        layout={fakeData}
        col={1}
        rowHeight={40}
        margin={[15, 5]}
        padding={10}
        className='plant-layout'
        style={{background: "rgb(247, 221, 255)"}}
        canResize={true}
        onDragEnd={(item, provided) => this.getLayout(item, provided)}
      >
        {(item, provided) => {
          const blockStyle = this.getblockStyle(provided.isDragging);
          const styleDiv = Object.assign({}, provided.props.style, blockStyle, {width: ` calc(100% - 30px)`});
          console.log('styleDiv', provided, blockStyle, styleDiv)
          return (
            <div {...provided.props} {...provided.dragHandle} style={styleDiv}>
              {provided.isDragging ? '正在抓取' : '停放'}{item.key}
            </div>
          )
        }}
      </Dragact>
    );
  }
}

export default DragactDemo;

const fakeData = [
  {GridX: 0, GridY: 0, w: 1, h: 2, key: "0"},
  {GridX: 0, GridY: 0, w: 1, h: 2, key: "1"},
  {GridX: 0, GridY: 0, w: 1, h: 2, key: "2"},
  {GridX: 0, GridY: 0, w: 1, h: 2, key: "3"},
];
Foveluy commented 6 years ago

@azz1123 有点奇妙,我去复现一下

azz1123 commented 6 years ago

@Foveluy 复现了吗

huhaoyang commented 5 years ago

@azz1123 解决了吗

MINGXINICE commented 5 years ago

请问IE11的问题解决了吗