Электрон Js Модал не открывается при использовании ipcRenderer - PullRequest
0 голосов
/ 16 марта 2020

Я пытаюсь получить информацию из модального окна с полями ввода. Тем не менее, я не могу проверить, работает ли мой модальный сбор информации, потому что, когда я добавляю код ip c, мой модальный режим не открывается. Когда я удаляю код ip c, открывается мой модал.

html

<script>    

// Modal

        document.getElementById('addItem').addEventListener('click', function(){
            document.querySelector(".bg-modal").style.display = "flex";
         });

        document.querySelector('.closeBtn').addEventListener('click', function(){
            document.querySelector(".bg-modal").style.display = "none";
        });

        // Add Information Event
        const electron = require('electron');
        const {ipcRenderer} = require('electron'); 

        const form = document.querySelector('form');
        form.addEventListener('submit', submitForm);

        function submitForm(e){
            e.preventDefault();
            const platformName = document.querySelector('#platformFor').value;
            const email = document.querySelector('#usernameForm').value;
            const starword = document.querySelector('#passwordFor').value;
            //ipcRenderer.send('information', platformName, email, starword);

            const container = document.querySelector('.informationContainer');
            const section = document.createElement('div');
            const item = document.createTextNode(platformName);

            container.appendChild(item);
        }

        /*const {ipcRenderer} = electron;
        const container = document.querySelector('.informationContainer');

        ipcRenderer.on('information', function(e, platformName){

        });*/

    </script>

js

ipcMain.on('information', function(e, platformName, email, starword){
      win.webContents.send('information', platformName);
  })
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...