|
@@ -537,31 +537,33 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
contentClone.querySelectorAll("table").forEach((table, tableIndex) => {
|
|
contentClone.querySelectorAll("table").forEach((table, tableIndex) => {
|
|
- table.style.borderCollapse = "separate";
|
|
|
|
- table.style.width = "100%";
|
|
|
|
- table.style.border = "none";
|
|
|
|
-
|
|
|
|
- table.querySelectorAll("tr").forEach((row, rowIndex) => {
|
|
|
|
- row.querySelectorAll("td, th").forEach((cell, cellIndex) => {
|
|
|
|
- cell.style.padding = "5px";
|
|
|
|
|
|
+ table.style.cssText = `
|
|
|
|
+ border-collapse: separate !important;
|
|
|
|
+ width: 100% !important;
|
|
|
|
+ border: none !important;
|
|
|
|
+ `;
|
|
|
|
+
|
|
|
|
+ table.querySelectorAll("tr").forEach((row, rowIndex) => {
|
|
|
|
+ row.querySelectorAll("td, th").forEach((cell, cellIndex) => {
|
|
|
|
+ let cellStyle = `
|
|
|
|
+ padding: 5px !important;
|
|
|
|
+ border: 0.1px solid #000000 !important;
|
|
|
|
+ `;
|
|
|
|
|
|
- // 为所有单元格设置右边框和下边框
|
|
|
|
- cell.style.borderRight = "0.1px solid #000000";
|
|
|
|
- cell.style.borderBottom = "0.1px solid #000000";
|
|
|
|
|
|
+ // 移除顶部边框(除了第一行)
|
|
|
|
+ if (rowIndex !== 0) {
|
|
|
|
+ cellStyle += 'border-top: none !important;';
|
|
|
|
+ }
|
|
|
|
|
|
- // 为所有行的第一个单元格设置左边框
|
|
|
|
- if (cellIndex === 0) {
|
|
|
|
- cell.style.borderLeft = "0px solid #000000";
|
|
|
|
- }
|
|
|
|
|
|
+ // 移除左侧边框(除了第一列)
|
|
|
|
+ if (cellIndex !== 0) {
|
|
|
|
+ cellStyle += 'border-left: none !important;';
|
|
|
|
+ }
|
|
|
|
|
|
- // 为第一行的所有单元格设置上边框
|
|
|
|
- if (rowIndex === 0) {
|
|
|
|
- cell.style.borderTop = "0px solid #000000";
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ cell.style.cssText += cellStyle;
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+ });
|
|
|
|
+ });
|
|
// 等待所有图片加载完成并转换为 Base64
|
|
// 等待所有图片加载完成并转换为 Base64
|
|
const images = contentClone.querySelectorAll("img");
|
|
const images = contentClone.querySelectorAll("img");
|
|
for (let img of images) {
|
|
for (let img of images) {
|