1.

解决columnsrender绑定最外层父组件this

一、使用构造函数

constructor( props ){

    super( props ) ;
    let self = this;

this.columns = [{
        title: '操作',
        dataIndex: 'operation',
        key: 'operation',
        render(text,record,index) {
        return (
            <div className="">
                <a style={{marginRight: 10}}>编辑</a>
                <a onClick={() => self.delClick()}>删除</a>
            </div>
        );
    }]

}

二、columns前加this.columns;

三、使用变量let self = this;

四、render时使用self.xxx()方法;

Ant Design 20180423

Ant Design 20180423

没有执行store里面的方法就加个’()’,让它执行

2.调用store里,并是store里的this有意义,我一把组件上的点击事件换成先触发一个事件,这个事件再去调用store里面的方法,store里面就可以读到this了,为什么,这两种操作有什么区别


相关文章:

  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2021-11-17
  • 2022-02-27
猜你喜欢
  • 2022-12-23
  • 2021-07-05
  • 2021-12-29
  • 2021-07-05
  • 2021-12-13
  • 2021-10-01
相关资源
相似解决方案