From 22d4b6551901d4ff39267d7cc2553785d6b7be89 Mon Sep 17 00:00:00 2001 From: zihanjian Date: Mon, 9 Jun 2025 11:28:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E8=B4=AD=E4=B9=B0=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=99=A8=E4=B8=AD=E6=B7=BB=E5=8A=A0AdSense?= =?UTF-8?q?=E5=B9=BF=E5=91=8A=E5=88=9D=E5=A7=8B=E5=8C=96=E5=92=8C=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E4=BD=8D=EF=BC=8C=E4=BC=98=E5=8C=96=E5=B9=BF=E5=91=8A?= =?UTF-8?q?=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- page.tsx | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/page.tsx b/page.tsx index 6939da3..78a3c84 100644 --- a/page.tsx +++ b/page.tsx @@ -1,4 +1,4 @@ -import React, { useState, useMemo } from 'react'; +import React, { useState, useMemo, useEffect } from 'react'; import { Calculator, ShoppingCart, TrendingUp, Shield, Clock, Heart, AlertTriangle, Settings } from 'lucide-react'; import DecisionChecks from './components/DecisionChecks'; @@ -133,6 +133,20 @@ const PurchaseDecisionCalculator = () => { const advice = getDecisionAdvice(calculateScore); + // AdSense 广告初始化 + useEffect(() => { + try { + if (typeof window !== 'undefined') { + const adsbygoogle = (window as any).adsbygoogle; + if (adsbygoogle) { + adsbygoogle.push({}); + } + } + } catch (err) { + console.log('AdSense error:', err); + } + }, []); + // 评分选项定义 const scoreOptions = { A1: [ @@ -485,6 +499,18 @@ const PurchaseDecisionCalculator = () => { + {/* AdSense 广告位 */} +
+ +
+
{/* 评分区域 */}