D
D
DaniilRuss2020-04-17 22:46:24
JavaScript
DaniilRuss, 2020-04-17 22:46:24

How can I make sure that the number that I clicked is substituted?

When you click on the "Call" link, the number from this.state.data should be substituted

export default class CallBack extends Component {
  constructor(props) {
    super(props)

    this.state = {
      data : [
        {
          key: 1,
          id: 1,
          name: 'Иван Иванов',
          phone: '+79882522312',
        },
        {
          key: 2,
          id: 2,
          name: 'Петя Иванов',
          phone: '88005553535',
        },
        {
          key: 3,
          id: 3,
          name: 'Вася Иванов',
          phone: '2445251',
        },
      ]
    }

    this.columns = [
      { title: 'id', dataIndex: 'id', key: 'id' },
      { title: 'Имя', dataIndex: 'name', key: 'name' },
      { title: 'Номер телефона', dataIndex: 'phone', key: 'phone' },
      {
        title: 'Действия',
        dataIndex: '',
        key: 'x',
        render: (record) => 
        this.state.data.length >= 1 ? (
          <div>
            <Popconfirm title="Вы уверены что хотите удалить?" okText="Да" cancelText="Нет"
            onConfirm={() => this.handleDelete(record.key)}>
                <a href="/call-back">Удалить</a>
            </Popconfirm>
                <a href={`tel:` + this.state.phone } // Вот тут!
                           className='feedback__link' 
                           onClick={() => this.handlePhone()}>Позвонить</a> 
          </div>
        ) :null,
      },
    ];
  
  }
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
real2210, 2020-04-17
@DaniilRuss

record phone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question