Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

取消pointer的change事件 #12

Open
cubemmc opened this issue Jul 29, 2019 · 0 comments
Open

取消pointer的change事件 #12

cubemmc opened this issue Jul 29, 2019 · 0 comments

Comments

@cubemmc
Copy link

cubemmc commented Jul 29, 2019

我想把pointer的change事件去掉,传的是一个component,但是传了之后没有效果怎么回事?

getPointer = () => {
    console.log(11111);
    this.setState({
      isOpen: false
    });
    return (
      <Pointer length={this.props.listImages.length} index={this.state.currIndex} changeIndex={() => {}}></Pointer>
    );
  }

pointer组件内容:

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';

class Pointer extends PureComponent {
  static propTypes = {
    length: PropTypes.number.isRequired,
    index: PropTypes.number.isRequired,
    changeIndex: PropTypes.func
  }

  render() {
    const {
      length,
      index
    } = this.props;

    let i = 0, items = [];
    for (i; i < length; i++) {
      if (i === index) {
        items.push(<span className='pointer on'></span>);
      } else {
        items.push(<span className='pointer'></span>);
      }
    }

    return (
      <div className='viewer-image-pointer'>
        {items}
      </div>
    );
  }
}

export default Pointer;
@cubemmc cubemmc changed the title 修改pointer的change事件 取消pointer的change事件 Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant