使用 bootstrap5 防止 table、table-条纹等 类

prevent table, table-striped etc classes with bootstrap5

使用 bootstrap5.0.0-beta3 和 bootstrap-table 1.18.2(目前是 webjars 中最新的)。

这是我的代码:

<table id="table">...</table> <!-- no classes here -->
$('#table').bootstrapTable({
    url:dataUrl
});

但是 bootstrap-table 正在添加额外的 类。这是结果 DOM:

<div class="bootstrap-table bootstrap5">
   ...
   <div class="fixed-table-body">
      <div class="fixed-table-loading table table-bordered table-hover">
         <table id="table" class="table table-bordered table-hover">...

我不想要 table-边框和 table- 悬停 类。我怎样才能避免这种情况(为什么首先要添加它们)?

您只需将其删除即可。这只是 bootstrap 的一种风格。你不需要它。