This commit is contained in:
toom1996
2026-09-28 10:53:33 +08:00
parent f8ff5b86c7
commit f56f46ae2f

View File

@ -9,14 +9,15 @@ interface Props {
mainId: string mainId: string
} }
const { mainId } = Astro.props const { mainId } = Astro.props
const count = `detailCount(${mainId})` const q = JSON.stringify(mainId) // 转成带引号的字符串字面量,否则 detailCount(i0008CZYI) 会被 Alpine 当成未定义变量
const count = `detailCount(${q})`
--- ---
<button <button
type="button" type="button"
x-show={`${count} > 0`} x-show={`${count} > 0`}
x-cloak x-cloak
@click.stop={`openDetailLb(${mainId})`} @click.stop={`openDetailLb(${q})`}
:title={`${count} + ' detail' + (${count} > 1 ? 's' : '')`} :title={`${count} + ' detail' + (${count} > 1 ? 's' : '')`}
:aria-label={`${count} + ' detail' + (${count} > 1 ? 's' : '')`} :aria-label={`${count} + ' detail' + (${count} > 1 ? 's' : '')`}
class="absolute left-2 bottom-2 z-10 flex items-center gap-1 px-1.5 py-1 bg-white/85 backdrop-blur-sm border border-black/15 text-[#111] text-[10px] uppercase tracking-[0.14em] cursor-pointer hover:bg-black hover:text-white transition-colors" class="absolute left-2 bottom-2 z-10 flex items-center gap-1 px-1.5 py-1 bg-white/85 backdrop-blur-sm border border-black/15 text-[#111] text-[10px] uppercase tracking-[0.14em] cursor-pointer hover:bg-black hover:text-white transition-colors"