简体   繁体   English

引导手风琴在 typescript 中不起作用

[英]Bootstrap accordion not working in typescript

I am trying to do an accordion using Bootstrap and for some reasons, whenever i click on the accordion, the toggle doesnt work.我正在尝试使用 Bootstrap 制作手风琴,由于某些原因,每当我点击手风琴时,切换按钮都不起作用。 I directly pasted the codes from tutorial sites but its still not working, I have imported bootstrap and jquery and wondering what else I am missing.我直接粘贴了教程网站上的代码,但它仍然无法正常工作,我已经导入了 bootstrap 和 jquery 并且想知道我还缺少什么。

This is my import这是我的进口

import {React, FormattedMessage, defaultMessages as jimuCoreDefaultMessage, AllWidgetProps, css, jsx, styled} from 'jimu-core';
 import {IMConfig} from '../config';
import { Tabs, Tab, Button} from 'jimu-ui';
import defaultMessages from './translations/default';
import {ProgressBar} from 'react-bootstrap';
 import 'bootstrap/dist/css/bootstrap.min.css';
import'./main.css';

import { render } from "react-dom";
import 'font-awesome/css/font-awesome.min.css';
import * as $ from 'jquery';

And this is my accordion code这是我的手风琴代码

<div class="container">
  <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Simple collapsible</button>
  <div id="demo" class="collapse">test</div>
</div>

I have been debugging for 2 days, it should be a 5 mins job and I am stuck and would appreciate some help.我已经调试了 2 天,这应该是一个 5 分钟的工作,我被卡住了,希望能得到一些帮助。 thanks in advance!提前致谢!

What version of Bootstrap and what version of jQuery do you use?你用的是什么版本的Bootstrap和什么版本的jQuery? Bootstrap 4.6.0 with jQuery 3.5.1 works well, but with jQuery 3.6.0 doesn't open dropdown menu for me.带有 jQuery 3.5.1 的 Bootstrap 4.6.0 运行良好,但带有 jQuery 3.6.0 并没有为我打开下拉菜单。 Maybe there is an error in jQuery 3.6.0 which causes similar problem with accordion like with dropdown menu. jQuery 3.6.0 中可能存在错误,这会导致与下拉菜单类似的手风琴问题。

Try to downgrade jQuery to version 3.5.1.尝试将 jQuery 降级到版本 3.5.1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM