搜索
鲸奇世界,弘创无限
与我们取得联系
请拨打电话或者扫描下方微信二维码联系我们。
24小时电话
188-2547-1709
微信 王经理
建站、SEO业务
微信 王经理
小程序、系统定制业务

鲸奇世界,弘创无限

Pbootcms产品规格参数表开发:自定义字段与前端展示的完整方案

鲸弘科技
2026-04-27
0 次

本文由广东鲸弘科技有限公司提供惠州小程序开发 / 网站建设专业分享。

产品规格参数表是产品中心的核心组成部分,用于清晰展示产品的核心参数(如尺寸、材质、性能、参数值等),帮助用户快速了解产品细节。在PbootCMS开发中,产品规格参数表的实现核心是通过自定义字段规范参数数据,结合前端模板渲染,实现参数表的结构化、可视化展示。

本文将提供一套完整方案,从后台自定义字段设计(适配不同类型参数)、参数数据录入规范,到前端多风格模板展示(基础表格、分组表格、折叠面板),再到高级优化(响应式适配、参数筛选),全程贴合PbootCMS实操需求,所有代码均经过实测可复用,新手可直接跟着操作,同时兼顾专业性与易用性。

适用场景:PbootCMS产品中心规格参数表开发、不同类型产品参数适配、前端参数表个性化展示;适配PbootCMS所有稳定版本,兼容自定义模板与官方模板,可直接衔接前期产品模型定制,实现产品参数的规范化管理与展示。

一、核心认知:产品规格参数表的设计逻辑

产品规格参数表的核心需求是“结构化展示参数”,需先明确两个核心逻辑,避免开发失误:

  • 参数分类:产品参数需按类型分组(如基础参数、性能参数、尺寸参数),避免杂乱无章,提升用户可读性;

  • 字段适配:不同类型的参数(如文本类、数字类、选择类),需对应PbootCMS不同的自定义字段类型,确保数据录入规范、前端渲染正常;

  • 复用性:自定义字段需适配多种产品类型,避免为每个产品单独创建字段,降低维护成本;

  • 联动性:后台参数字段与前端模板联动,确保后台录入的参数能精准渲染到前端,无需手动修改模板。

关键前提:需先完成产品内容模型(product)的创建(参考前期内容模型定制教程),本文基于产品模型,新增规格参数相关自定义字段,实现参数表开发。

二、后台配置:自定义字段设计(核心步骤)

产品规格参数的后台配置核心是“设计合理的自定义字段”,按参数类型分为“基础通用参数”“分组专项参数”,字段类型适配参数内容,同时兼顾后台录入效率与前端渲染需求,步骤如下:

2.1 字段设计原则(必遵循)

  • 字段标识:统一规范,格式为“spec_分组_字段名”(如spec_base_material,代表基础参数-材质),英文小写、无空格、无特殊字符,避免与系统默认字段或其他自定义字段冲突;

  • 字段类型:按参数内容选择(文本类用单行文本,数字类用数字,固定选项用下拉选择),避免类型错配导致前端渲染异常;

  • 分组清晰:按参数类型分组设置字段排序,同一分组的字段排序连续,便于后台录入人员按顺序填写;

  • 必填控制:核心参数(如型号、材质)设为必填,非核心参数(如备注)设为非必填,确保参数完整性;

  • 字段提示:明确填写规范(如“尺寸单位:mm”“材质填写中文全称”),降低后台录入错误率。

2.2 具体字段配置(可直接复用)

以“通用工业产品”为例,按“基础参数、性能参数、尺寸参数、其他参数”分组,配置对应的自定义字段,操作入口:【内容模型管理】→ 产品模型(product)→【编辑】→【新增字段】,具体配置如下表:

参数分组

字段名称

字段标识

字段类型

是否必填

字段提示

排序

基础参数

产品型号

spec_base_model

单行文本

填写产品唯一型号,如PB-2026

10

材质

spec_base_material

单行文本

填写材质全称,如不锈钢、铝合金

11

颜色

spec_base_color

下拉选择

选择产品可用颜色

12

适用场景

spec_base_scene

多行文本

填写产品适用的场景,用逗号分隔

13

性能参数

额定功率

spec_perf_power

数字

单位:W,填写数字即可

14

工作电压

spec_perf_voltage

数字

单位:V,填写数字即可

15

工作温度

spec_perf_temp

单行文本

单位:℃,如-10~60℃

16

尺寸参数

长度

spec_size_length

数字

单位:mm,填写数字即可

17

宽度

spec_size_width

数字

单位:mm,填写数字即可

18

高度

spec_size_height

数字

单位:mm,填写数字即可

19

其他参数

重量

spec_other_weight

数字

单位:kg,填写数字即可

20

质保期限

spec_other_warranty

单行文本

如1年质保、3年质保

21

补充说明:

  • 下拉选择字段(如颜色):配置时在“选项”中填写可选值,用逗号分隔(如“银色,黑色,灰色”),后台录入时直接选择,避免手动输入错误;

  • 数字字段:仅允许输入数字,无需手动填写单位,单位在字段提示中说明,前端展示时统一拼接,确保规范;

  • 字段排序:按“基础参数→性能参数→尺寸参数→其他参数”的顺序设置排序值,确保后台录入页面字段顺序清晰,便于操作;

  • 可扩展性:若需新增参数(如“防水等级”),直接在对应分组下新增字段,按上述规范设置即可,无需修改前端模板核心结构。

2.3 后台数据录入规范(避免前端渲染错乱)

  • 数字类参数:严格按字段提示填写(仅填数字),如“额定功率”填写“500”,不可填写“500W”“500瓦”,前端统一拼接单位;

  • 文本类参数:填写简洁准确,避免冗余(如材质填写“304不锈钢”,不可填写“优质304不锈钢材质,耐腐蚀”);

  • 下拉选择参数:必须从选项中选择,不可手动输入其他值,确保参数统一;

  • 空值处理:非必填参数若无需填写,保持空值即可,前端模板会自动处理为“暂无数据”,无需填写“无”“0”等无效值。

三、前端展示:3种高频模板方案(可直接复制复用)

前端展示的核心是“结构化渲染参数”,结合不同产品风格(简约、专业、详细),提供3种高频模板方案,均适配PbootCMS标签,支持响应式,可直接复制到产品详情页模板(product_content.html)中使用,核心调用语法为{content:ext_字段标识}。

方案1:基础简约表格(通用型,适配所有产品)

特点:简洁清晰,无分组,适合参数较少的产品(如日用百货、小型配件),代码简洁,加载速度快。

<!-- 产品规格参数表(基础简约版) -->
<div class="product-spec basic-spec">
    <h3 class="spec-title">产品规格参数</h3>
    <table class="spec-table">
        <tbody>
            <tr>
                <td class="spec-label">产品型号</td>
                <td class="spec-value">{pboot:if [content:ext_spec_base_model] != ""}{content:ext_spec_base_model}{else}暂无数据{/pboot:if}</td>
            </tr>
            <tr>
                <td class="spec-label">材质</td>
                <td class="spec-value">{pboot:if [content:ext_spec_base_material] != ""}{content:ext_spec_base_material}{else}暂无数据{/pboot:if}</td>
            </tr>
            <tr>
                <td class="spec-label">颜色</td>
                <td class="spec-value">{pboot:if [content:ext_spec_base_color] != ""}{content:ext_spec_base_color}{else}暂无数据{/pboot:if}</td>
            </tr>
            <tr>
                <td class="spec-label">额定功率</td>
                <td class="spec-value">{pboot:if [content:ext_spec_perf_power] != ""}{content:ext_spec_perf_power}W{else}暂无数据{/pboot:if}</td>
            </tr>
            <tr>
                <td class="spec-label">工作电压</td>
                <td class="spec-value">{pboot:if [content:ext_spec_perf_voltage] != ""}{content:ext_spec_perf_voltage}V{else}暂无数据{/pboot:if}</td>
            </tr>
            <tr>
                <td class="spec-label">尺寸(长×宽×高)</td>
                <td class="spec-value">
                    {pboot:if [content:ext_spec_size_length] != ""}
                        {content:ext_spec_size_length}×{content:ext_spec_size_width}×{content:ext_spec_size_height}mm
                    {else}
                        暂无数据
                    {/pboot:if}
                </td>
            </tr>
            <tr>
                <td class="spec-label">质保期限</td>
                <td class="spec-value">{pboot:if [content:ext_spec_other_warranty] != ""}{content:ext_spec_other_warranty}{else}暂无数据{/pboot:if}</td>
            </tr>
        </tbody>
    </table>
</div>
<!-- 基础表格CSS(适配响应式) -->
<style>
.basic-spec .spec-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid #eee;
}
.basic-spec .spec-table tr {
    border-bottom: 1px solid #eee;
}
.basic-spec .spec-table tr:last-child {
    border-bottom: none;
}
.basic-spec .spec-label {
    width: 30%;
    padding: 12px 15px;
    background-color: #f8f9fa;
    font-weight: 600;
    text-align: left;
}
.basic-spec .spec-value {
    padding: 12px 15px;
    color: #333;
}
/* 响应式适配(手机端) */
@media (max-width: 768px) {
    .basic-spec .spec-label {
        width: 40%;
        font-size: 14px;
    }
    .basic-spec .spec-value {
        font-size: 14px;
    }
}
</style>

方案2:分组表格(专业型,适配参数较多的产品)

特点:按参数分组展示,有分组标题,适合工业产品、电子产品等参数较多的场景,层次清晰,用户可快速定位所需参数。

<!-- 产品规格参数表(分组专业版) -->
<div class="product-spec group-spec">
    <h3 class="spec-title"&gt;产品规格参数&lt;/h3&gt;
    
    <!-- 基础参数分组 -->
    <div class="spec-group">
        <h4 class="group-title">基础参数</h4>
        <table class="group-table">
            <tbody>
                <tr>
                    <td class="spec-label">产品型号</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_base_model] != ""}{content:ext_spec_base_model}{else}暂无数据{/pboot:if}</td>
                </tr>
                <tr>
                    <td class="spec-label">材质</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_base_material] != ""}{content:ext_spec_base_material}{else}暂无数据{/pboot:if}</td>
                </tr>
                <tr>
                    <td class="spec-label">颜色</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_base_color] != ""}{content:ext_spec_base_color}{else}暂无数据{/pboot:if}</td>
                </tr>
                <tr>
                    <td class="spec-label">适用场景</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_base_scene] != ""}{content:ext_spec_base_scene}{else}暂无数据{/pboot:if}</td>
                </tr>
            </tbody>
        </table>
    </div><!-- 性能参数分组 -->
    <div class="spec-group">
        <h4 class="group-title">性能参数</h4>
        <table class="group-table">
            <tbody>
                <tr>
                    <td class="spec-label">额定功率</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_perf_power] != ""}{content:ext_spec_perf_power}W{else}暂无数据{/pboot:if}</td>
                </tr>
                <tr>
                    <td class="spec-label">工作电压</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_perf_voltage] != ""}{content:ext_spec_perf_voltage}V{else}暂无数据{/pboot:if}</td>
                </tr>
                <tr>
                    <td class="spec-label">工作温度</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_perf_temp] != ""}{content:ext_spec_perf_temp}{else}暂无数据{/pboot:if}</td>
                </tr>
            </tbody>
        &lt;/table&gt;
    &lt;/div&gt;
    
    <!-- 尺寸参数分组 -->
    <div class="spec-group">
        <h4 class="group-title">尺寸参数</h4>
        <table class="group-table">
            <tbody>
                <tr>
                    <td class="spec-label">长度</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_size_length] != ""}{content:ext_spec_size_length}mm{else}暂无数据{/pboot:if}</td>
                </tr>
                <tr>
                    <td class="spec-label">宽度</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_size_width] != ""}{content:ext_spec_size_width}mm{else}暂无数据{/pboot:if}</td>
                </tr>
                <tr>
                    <td class="spec-label">高度</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_size_height] != ""}{content:ext_spec_size_height}mm{else}暂无数据{/pboot:if}</td>
                </tr>
            </tbody>
        </table>
    </div>
    
<!-- 其他参数分组 -->
    <div class="spec-group">
        <h4 class="group-title">其他参数</h4>
        <table class="group-table">
            <tbody>
                <tr>
                    <td class="spec-label">重量</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_other_weight] != ""}{content:ext_spec_other_weight}kg{else}暂无数据{/pboot:if}</td>
                </tr>
                <tr>
                    <td class="spec-label">质保期限</td>
                    <td class="spec-value">{pboot:if [content:ext_spec_other_warranty] != ""}{content:ext_spec_other_warranty}{else}暂无数据{/pboot:if}</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<!-- 分组表格CSS -->
<style>
.group-spec .spec-title {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}
.group-spec .spec-group {
    margin-bottom: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}
.group-spec .group-title {
    padding: 12px 15px;
    background-color: #e8f4f8;
    color: #1890ff;
    font-size: 16px;
    margin: 0;
}
.group-spec .group-table {
    width: 100%;
    border-collapse: collapse;
}
.group-spec .group-table tr {
    border-bottom: 1px solid #eee;
}
.group-spec .group-table tr:last-child {
    border-bottom: none;
}
.group-spec .spec-label {
    width: 30%;
    padding: 10px 15px;
    background-color: #f8f9fa;
    font-weight: 600;
}
.group-spec .spec-value {
    padding: 10px 15px;
    color: #333;
}
/* 响应式适配 */
@media (max-width: 768px) {
    .group-spec .spec-label {
        width: 40%;
        font-size: 14px;
    }
    .group-spec .spec-value {
        font-size: 14px;
    }
    .group-spec .group-title {
        font-size: 15px;
    }
}
</style>

方案3:折叠面板(节省空间,适配参数极多的产品)

特点:分组折叠,默认只显示分组标题,点击展开对应参数,适合参数极多(20+)的产品(如大型设备、精密仪器),节省页面空间,提升用户体验。

<!-- 产品规格参数表(折叠面板版) -->
<div class="product-spec collapse-spec">
    <h3 class="spec-title"&gt;产品规格参数&lt;/h3&gt;
    
    <!-- 基础参数折叠面板 -->
    <div class="collapse-panel">
        <div class="panel-header" onclick="toggleCollapse(this)">
            <h4 class="panel-title">基础参数</h4>
            <span class="panel-icon">+</span>
        </div>
        <div class="panel-content" style="display: none;">
            <table class="collapse-table">
                <tbody>
                    <tr>
                        <td class="spec-label">产品型号</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_base_model] != ""}{content:ext_spec_base_model}{else}暂无数据{/pboot:if}</td>
                    </tr>
                    <tr>
                        <td class="spec-label">材质</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_base_material] != ""}{content:ext_spec_base_material}{else}暂无数据{/pboot:if}</td>
                    </tr>
                    <tr>
                        <td class="spec-label">颜色</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_base_color] != ""}{content:ext_spec_base_color}{else}暂无数据{/pboot:if}</td>
                    </tr>
                    <tr>
                        <td class="spec-label">适用场景</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_base_scene] != ""}{content:ext_spec_base_scene}{else}暂无数据{/pboot:if}</td>
                    </tr>
                </tbody>
            </table>
        &lt;/div&gt;
    &lt;/div&gt;
    
    <!-- 性能参数折叠面板 -->
    <div class="collapse-panel">
        <div class="panel-header" onclick="toggleCollapse(this)">
            <h4 class="panel-title">性能参数</h4>
            <span class="panel-icon">+</span>
        </div>
        <div class="panel-content" style="display: none;">
            <table class="collapse-table">
                <tbody>
                    <tr>
                        <td class="spec-label">额定功率</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_perf_power] != ""}{content:ext_spec_perf_power}W{else}暂无数据{/pboot:if}</td>
                    </tr>
                    <tr>
                        <td class="spec-label">工作电压</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_perf_voltage] != ""}{content:ext_spec_perf_voltage}V{else}暂无数据{/pboot:if}</td>
                    </tr>
                    <tr>
                        <td class="spec-label">工作温度</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_perf_temp] != ""}{content:ext_spec_perf_temp}{else}暂无数据{/pboot:if}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    &lt;/div&gt;
    
    <!-- 尺寸参数折叠面板 -->
    <div class="collapse-panel">
        <div class="panel-header" onclick="toggleCollapse(this)">
            <h4 class="panel-title">尺寸参数</h4>
            <span class="panel-icon">+</span>
        </div>
        <div class="panel-content" style="display: none;">
            <table class="collapse-table">
                <tbody>
                    <tr>
                        <td class="spec-label">长度</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_size_length] != ""}{content:ext_spec_size_length}mm{else}暂无数据{/pboot:if}</td>
                    </tr>
                    <tr>
                        <td class="spec-label">宽度</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_size_width] != ""}{content:ext_spec_size_width}mm{else}暂无数据{/pboot:if}</td>
                    </tr>
                    <tr>
                        <td class="spec-label">高度</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_size_height] != ""}{content:ext_spec_size_height}mm{else}暂无数据{/pboot:if}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div&gt;
    
    <!-- 其他参数折叠面板 -->
    <div class="collapse-panel">
        <div class="panel-header" onclick="toggleCollapse(this)">
            <h4 class="panel-title">其他参数</h4>
            <span class="panel-icon">+</span>
        </div>
        <div class="panel-content" style="display: none;">
            <table class="collapse-table">
                <tbody>
                    <tr>
                        <td class="spec-label">重量</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_other_weight] != ""}{content:ext_spec_other_weight}kg{else}暂无数据{/pboot:if}</td>
                    </tr>
                    <tr>
                        <td class="spec-label">质保期限</td>
                        <td class="spec-value">{pboot:if [content:ext_spec_other_warranty] != ""}{content:ext_spec_other_warranty}{else}暂无数据{/pboot:if}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- 折叠面板JS(切换展开/收起) -->
<script>
function toggleCollapse(el) {
    // 切换面板内容显示/隐藏
    const content = el.nextElementSibling;
    const icon = el.querySelector('.panel-icon');
    if (content.style.display === 'none') {
        content.style.display = 'block';
        icon.textContent = '-';
    } else {
        content.style.display = 'none';
        icon.textContent = '+';
    }
}
// 可选:默认展开第一个面板
document.querySelector('.collapse-panel .panel-header').click();
</script>
<!-- 折叠面板CSS -->
<style>
.collapse-spec .spec-title {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}
.collapse-panel {
    margin-bottom: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}
.collapse-panel .panel-header {
    padding: 12px 15px;
    background-color: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.collapse-panel .panel-title {
    margin: 0;
    font-size: 16px;
    color: #333;
}
.collapse-panel .panel-icon {
    font-size: 18px;
    color: #1890ff;
}
.collapse-panel .panel-content {
    padding: 15px;
}
.collapse-table {
    width: 100%;
    border-collapse: collapse;
}
.collapse-table tr {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}
.collapse-table tr:last-child {
    border-bottom: none;
}
.collapse-table .spec-label {
    width: 30%;
    padding: 8px 0;
    font-weight: 600;
    color: #666;
}
.collapse-table .spec-value {
    padding: 8px 0;
    color: #333;
}
/* 响应式适配 */
@media (max-width: 768px) {
    .collapse-panel .panel-title {
        font-size: 15px;
    }
    .collapse-table .spec-label {
        width: 40%;
        font-size: 14px;
    }
    .collapse-table .spec-value {
        font-size: 14px;
    }
}
</style>

前端调用注意事项

  • 字段标识匹配:模板中调用的{content:ext_字段标识},必须与后台配置的“字段标识”完全一致(区分大小写,如ext_spec_base_model不可写错);

  • 空值兜底:所有参数调用均需添加{pboot:if}判断空值,避免参数为空时显示空白,提升页面美观度;

  • 单位拼接:数字类参数(如功率、尺寸),后台仅录入数字,前端模板统一拼接单位(如W、mm),确保规范;

  • 响应式适配:所有模板均添加了手机端适配CSS,可根据自身站点风格调整颜色、间距,适配不同设备;

  • 模板复用:可将参数表代码封装为单独的模板片段(如spec_table.html),在产品详情页通过{pboot:include file="spec_table.html"}调用,提升代码复用性。

四、高级优化:提升参数表实用性与体验

基于基础方案,可进行以下高级优化,让参数表更具实用性,适配更多场景:

4.1 参数筛选功能(多产品对比场景)

若产品中心有多个产品,可实现“按参数筛选产品”(如筛选“材质为不锈钢”“功率500W以上”的产品),核心代码示例:

<!-- 参数筛选表单 -->
<div class="spec-filter">
    <h3>按参数筛选</h3>
    <form action="{pboot:listurl scode='product'}" method="get">
        <div class="filter-item">
            <label>材质:</label>
            <select name="ext_spec_base_material">
                <option value="">全部</option>
                <option value="不锈钢" {pboot:if $ext_spec_base_material == '不锈钢'}selected{/pboot:if}>不锈钢</option>
                <option value="铝合金" {pboot:if $ext_spec_base_material == '铝合金'}selected{/pboot:if}>铝合金</option>
                <option value="塑料" {pboot:if $ext_spec_base_material == '塑料'}selected{/pboot:if}>塑料</option>
            </select>
        </div>
        <div class="filter-item">
            <label>额定功率:</label>
            <select name="ext_spec_perf_power_min">
                <option value="">最小功率</option>
                <option value="300" {pboot:if $ext_spec_perf_power_min == 300}selected{/pboot:if}>300W</option>
                <option value="500" {pboot:if $ext_spec_perf_power_min == 500}selected{/pboot:if}>500W</option>
                <option value="1000" {pboot:if $ext_spec_perf_power_min == 1000}selected{/pboot:if}>1000W</option>
            </select>
        </div>
        <button type="submit" class="filter-btn">筛选</button>
    </form>
</div>
<!-- 筛选后产品列表 -->
<div class="product-list">
    {pboot:list scode="product" num="12" page="1" ext_spec_base_material="$ext_spec_base_material" ext_spec_perf_power="$ext_spec_perf_power_min-">
        <!-- 产品列表内容(省略,参考前期教程) -->
    {/pboot:list}
</div>

说明:ext_spec_perf_power="$ext_spec_perf_power_min-" 表示筛选“功率大于等于最小功率”的产品,若需筛选区间,可添加max参数,实现精准筛选。

4.2 产品参数对比功能(多产品横向对比)

适合用户需要对比多个产品参数的场景,核心是获取多个产品的参数,横向渲染对比表格,代码示例:

<!-- 产品参数对比表 -->
<div class="product-compare">
    <h3 class="compare-title">产品参数对比</h3>
    <table class="compare-table">
        <thead>
            <tr>
                <th class="compare-label">参数名称</th>
                <!-- 产品1 -->
                <th class="compare-product">{pboot:content id=1 title=true}</th>
                <!-- 产品2 -->
                <th class="compare-product">{pboot:content id=2 title=true}</th>
                <!-- 产品3 -->
                <th class="compare-product">{pboot:content id=3 title=true}</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="compare-label">产品型号</td>
                <td>{pboot:content id=1 ext=spec_base_model}</td>
                <td>{pboot:content id=2 ext=spec_base_model}</td>
                <td>{pboot:content id=3 ext=spec_base_model}</td>
            </tr>
            <tr>
                <td class="compare-label">材质</td>
                <td>{pboot:content id=1 ext=spec_base_material}</td>
                <td>{pboot:content id=2 ext=spec_base_material}</td>
                <td>{pboot:content id=3 ext=spec_base_material}</td>
            </tr>
            <tr>
                <td class="compare-label">额定功率</td>
                <td>{pboot:content id=1 ext=spec_perf_power}W</td>
                <td>{pboot:content id=2 ext=spec_perf_power}W</td>
                <td>{pboot:content id=3 ext=spec_perf_power}W</td>
            </tr>
            <tr>
                <td class="compare-label">尺寸</td>
                <td>{pboot:content id=1 ext=spec_size_length}×{pboot:content id=1 ext=spec_size_width}×{pboot:content id=1 ext=spec_size_height}mm</td>
                <td>{pboot:content id=2 ext=spec_size_length}×{pboot:content id=2 ext=spec_size_width}×{pboot:content id=2 ext=spec_size_height}mm</td>
                <td>{pboot:content id=3 ext=spec_size_length}×{pboot:content id=3 ext=spec_size_width}×{pboot:content id=3 ext=spec_size_height}mm</td>
            </tr>
        </tbody>
    </table>
</div>

说明:id=1、id=2、id=3对应产品的内容ID,可通过后台“内容管理”查看产品ID,也可通过前端选择功能,让用户自主选择对比产品(需配合JS实现)。

4.3 参数表样式个性化(贴合站点风格)

  • 颜色适配:修改CSS中的颜色值(如分组标题颜色、边框颜色),贴合站点主色调;

  • hover效果:为表格行、折叠面板添加hover效果,提升交互体验,示例CSS:.spec-table tr:hover { background-color: #f8f9fa; }

  • 图标添加:为参数标签添加对应图标(如尺寸添加

AI 智能助理
您好!有什么可以帮助您的吗?
  • 稳定
    多年经验,服务稳定
  • 贴心
    全国7*24小时客服热线
  • 专业
    产品经理在线技术支持
  • 快速
    快速评估,快速执行
  • 承诺
    有目共睹,我们选声誉
复制成功

微信号:kaxiO_o

添加微信好友,免费获取方案及报价

我知道了
联系
扫码添加技术微信
1V1在线技术支持
联系电话
188-2547-1709建站、seo业务
电话若占线或未接到、就加下微信
联系邮箱
frank@vi23.com企业邮箱