M
M
Max2021-04-06 14:44:14
UIkit
Max, 2021-04-06 14:44:14

Why don't functions work from a modal window?

Calling a function does not work when I call it from a modal window.
If in the layout to take out the button from the modal window, everything works.

The modal window itself also works (opens, closes)
When opening the "Cancel" button in the modal window, it works, but this is through the layout class "uk-modal-close"

Tried other functions to call from the modal window, they do not work
.....
Import :

import React, {Component} from 'react';
  import UIkit from 'uikit';


Render:
render() {
    const modal = true;
    return (
        <>
            <div className='panel'>
                <button className="uk-button uk-button-primary" onClick={() => this.save()}>Publish</button> // Работает  !!!
                <button className="uk-button uk-button-primary" uk-toggle="target: #modal-save">Save</button>
            </div>

            <div id="modal-save" uk-modal={modal.toString()}>
                <div className="uk-modal-dialog uk-modal-body">
                    <h2 className="uk-modal-title">Saving</h2>
                    <p>Are you sure you want to save the page?</p>
                    <p className="uk-text-right">
                        <button className="uk-button uk-button-default uk-modal-close" type="button">Cancel</button>
                        <button className="uk-button uk-button-primary"  onClick={() => this.save()}>Publish</button> // Не Работает! 
                    </p>
                </div>
            </div>
        </>
    )
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question