wangeditor/editor插线表格没有border
时间: 2024-01-13 18:04:34 浏览: 145
要在wangeditor/editor插入表格并去掉边框,可以使用以下方法:
1. 使用CSS样式:可以通过为表格添加CSS样式来去掉边框。在wangeditor/editor中,可以通过在表格标签上添加class属性,并在CSS文件中定义该class的样式来实现。例如:
```html
<table class="no-border">
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
<tr>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
</table>
```
```css
.no-border {
border-collapse: collapse;
border: none;
}
```
2. 使用wangeditor/editor的API:wangeditor/editor提供了一些API方法,可以在插入表格时设置表格的样式。可以使用`editor.customConfig.onchange`方法来监听表格插入事件,并在插入表格后修改表格的样式。例如:
```javascript
editor.customConfig.onchange = function (html) {
var tableList = document.querySelectorAll('.w-e-table');
tableList.forEach(function (table) {
table.style.borderCollapse = 'collapse';
table.style.border = 'none';
});
};
```
以上是两种去掉wangeditor/editor插入表格边框的方法。
阅读全文
相关推荐














