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 广告位 */} +
+ +
+
{/* 评分区域 */}