英文:
How to display Bootstrap modal in Electron?
问题
尝试在Electron中显示Bootstrap模态框。
我已安装了jquery和bootstrap模块。
然后在.js文件中编写了以下代码。
const $ = require('jquery');
require('bootstrap');
$(document).ready(() => {
$('#myModal').modal();
});
当然,在.html文件中有一个id为myModal的
标签。
然而,运行时出现以下错误。
I have installed jquery and bootstrap modules.
Of course, there is Div tag with id=myModal in .html file.
然而,运行时出现以下错误。
$(...).modal 不是一个函数。
原因是什么,如何实现它?
英文:
Trying to display Bootstrap Modal in electron.
I have installed jquery and bootstrap modules.
Then wrote following code in .js file.
const $ = require('jquery');
require('bootstrap');
$(document).ready(() => {
$('#myModal').modal();
});
Of course, there is Div tag with id=myModal in .html file.
However, when running, the following error is displayed.
$(...).modal is not a function.
What is the reason and how to implement it?
答案1
得分: 0
我在之前的ElectronJS中遇到了Bootstrap模态窗口的问题。使用以下代码时,它可以正常工作。
var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
英文:
Try please your app with this code
var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
I met Bootstrap modal issue in ElectronJS in before.
It was work well with this code.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
- bootstrap-4
- bootstrap-modal
- electron
- javascript
- jquery
评论