如何在Electron中显示Bootstrap模态?

问题描述 投票:0回答:1

尝试在电子中显示 Bootstrap Modal。

我已经安装了jquery和bootstrap模块。 然后在.js文件中写入以下代码。

const $ = require('jquery');
require('bootstrap');

$(document).ready(() => {
  $('#myModal').modal();
});

当然,.html 文件中有 id=myModal 的 Div 标签。 但是运行的时候却出现如下错误。

$(...).modal is not a function.

原因是什么以及如何实施?

javascript jquery bootstrap-4 electron bootstrap-modal
1个回答
0
投票

尝试使用此代码请您的应用程序

var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)

我之前在 ElectronJS 中遇到过 Bootstrap 模态问题。 这段代码运行得很好。

© www.soinside.com 2019 - 2024. All rights reserved.