From f26f98c02a5fac337ce14a435216ed97dde07491 Mon Sep 17 00:00:00 2001 From: peijunlei Date: Fri, 11 Sep 2026 17:58:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(product.js):=20=E7=9B=B8=E5=85=B3=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=A8=A1=E5=9D=97=E4=B8=8D=E8=B6=85=E8=BF=874?= =?UTF-8?q?=E4=B8=AA=E6=97=B6=E3=80=82=E4=B8=8D=E5=B1=95=E7=A4=BA=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=8C=89=E9=92=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/themes/dist_static/static/js/product.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/themes/dist_static/static/js/product.js b/public/themes/dist_static/static/js/product.js index bb083c1..b47e3c6 100644 --- a/public/themes/dist_static/static/js/product.js +++ b/public/themes/dist_static/static/js/product.js @@ -32,10 +32,18 @@ function relatedCarouselInit() { const root = document.querySelector(".p-related"); const el = root?.querySelector(".p-related__swiper"); if (!root || !el || !window.Swiper) return; + const slideCount = el.querySelectorAll(".swiper-wrapper > .swiper-slide").length; + // 一屏展示 4 条,不超过 4 条时隐藏切换按钮 + if (slideCount <= 4) { + root.querySelectorAll(".p-related__header .s-arrows").forEach((node) => { + node.style.display = "none"; + }); + } new window.Swiper(el, { slidesPerView: 1.15, spaceBetween: 16, grabCursor: true, + watchOverflow: true, pagination: { el: root.querySelector(".p-related__pagination"), clickable: true