油猴插件添加如下脚本:
// ==UserScript==
// @name TEMU产品详情页表格样式优化
// @namespace http://tampermonkey.net/
// @version 0.4
// @description 优化TEMU产品详情页后台表格样式,调整列宽
// @author Your name
// @match https://seller.kuajingmaihuo.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const style = document.createElement('style');
style.textContent = `
/* 基础容器样式 */
body {
min-width: 1360px !important;
overflow-x: auto !important;
}
.Scrollbar_wrapper_5-113-0 {
max-width: 1360px !important;
margin: 0 auto !important;
overflow: visible !important;
}
/* 表格容器样式 */
.performance-table_tableScrollContainer__1R2B_ {
width: 100% !important;
max-width: 1360px !important;
margin: 0 auto !important;
overflow-x: auto !important;
}
/* 调整列宽 */
.performance-table_performanceTable__37JTX {
width: 100% !important;
max-width: 1360px !important;
margin: 0 auto !important;
border-collapse: collapse !important;
table-layout: fixed !important;
}
/* 具体列宽设置 */
.performance-table_performanceTable__37JTX colgroup col:nth-child(1) { width: 80px !important; } /* 颜色 */
.performance-table_performanceTable__37JTX colgroup col:nth-child(2) { width: 80px !important; } /* 参考链接 */
.performance-table_performanceTable__37JTX colgroup col:nth-child(3) { width: 180px !important; } /* 申报价格 */
.performance-table_performanceTable__37JTX colgroup col:nth-child(4) { width: 180px !important; } /* 库存 */
.performance-table_performanceTable__37JTX colgroup col:nth-child(5) { width: 80px !important; } /* 预览图 */
.performance-table_performanceTable__37JTX colgroup col:nth-child(6) { width: 80px !important; } /* SKU分类 */
.performance-table_performanceTable__37JTX colgroup col:nth-child(7) { width: 140px !important; } /* 建议零售价 */
.performance-table_performanceTable__37JTX colgroup col:nth-child(8) { width: 160px !important; } /* 商品编码(选填 */
/* 预览图样式优化 */
.preview-image_img__2UEus {
max-width: 80px !important;
height: auto !important;
}
/* 表格单元格基础样式 */
.performance-table_cell__3U4oR {
padding: 8px !important;
text-align: left !important;
vertical-align: middle !important;
border: 1px solid #e8e8e8 !important;
white-space: nowrap !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
}
/* 表头样式 */
.performance-table_th__3BTgR {
background-color: #fafafa !important;
font-weight: 500 !important;
padding: 8px !important;
white-space: nowrap !important;
}
/* 输入框和下拉框样式 */
.IPT_input_5-113-0,
.ST_head_5-113-0 {
max-width: 100% !important;
box-sizing: border-box !important;
padding: 4px 8px !important;
}
/* 批量操作区域样式 */
.batch-input_batchContainer__wyJWJ {
width: 100% !important;
max-width: 1360px !important;
margin: 0 auto 16px !important;
padding: 12px !important;
background: #fff !important;
border-radius: 4px !important;
box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
box-sizing: border-box !important;
}
/* 优化滚动条 */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 3px;
}
::-webkit-scrollbar-thumb {
background: #888;
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
`;
document.head.appendChild(style);
// 监听DOM变化
const observer = new MutationObserver(() => {
const containers = document.querySelectorAll('.performance-table_tableScrollContainer__1R2B_, .formItemContainer');
containers.forEach(container => {
if (container) {
container.style.maxWidth = '1360px';
container.style.margin = '0 auto';
}
});
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();