qb-pc-sdk 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -75,7 +75,7 @@ app.whenReady().then(createWindow);
75
75
  data-placement-id="your-placement-id"
76
76
  >
77
77
  </ins>
78
- <script src="https://unpkg.com/qb-pc-sdk@latest/core.min.js"></script>
78
+ <script src="https://unpkg.com/qb-pc-sdk@latest/inline-loader.js"></script>
79
79
  <script>
80
80
  (window.qbAds = window.qbAds || []).push({});
81
81
  </script>
@@ -115,7 +115,7 @@ SDK 会自动检测运行环境:
115
115
 
116
116
  ### ⭐ CDN 模式
117
117
 
118
- <script src="https://unpkg.com/qb-pc-sdk@latest/core.min.js" defer></script>
118
+ <script src="https://unpkg.com/qb-pc-sdk@latest/inline-loader.js" defer></script>
119
119
 
120
120
  ````
121
121
  ### NPM 方式(模块化项目推荐)
@@ -308,7 +308,7 @@ onBeforeUnmount(() => {
308
308
  </head>
309
309
  <body>
310
310
  <div id="ad-container"></div>
311
- <script src="https://unpkg.com/qb-pc-sdk@latest/core.min.js"></script>
311
+ <script src="https://unpkg.com/qb-pc-sdk@latest/inline-loader.js"></script>
312
312
 
313
313
  <!-- 使用 SDK -->
314
314
  <script>
@@ -369,9 +369,27 @@ onBeforeUnmount(() => {
369
369
  如果需要使用外部文件方式指定特定版本:
370
370
 
371
371
  ```html
372
- <script src="https://unpkg.com/qb-pc-sdk@latest/core.min.js"></script>
372
+ <script src="https://unpkg.com/qb-pc-sdk@latest/inline-loader.js"></script>
373
373
  ```
374
374
 
375
+ #### 懒加载(.lazy-ad,推荐用于长页)
376
+
377
+ 引用 SDK 后,可使用 **懒加载**:广告位仅在**即将进入视口(约 200px 内)**时再请求,避免「返回高、曝光低」。
378
+
379
+ **用法:** 在页面中放入带 `class="lazy-ad"` 的 div,并设置 `data-app-id`、`data-ad-id`(或 `data-placement-id`),无需再写任何 JS。
380
+
381
+ ```html
382
+ <!-- 引用 SDK -->
383
+ <script src="https://unpkg.com/qb-pc-sdk@latest/inline-loader.js"></script>
384
+
385
+ <!-- 广告位:进入视口约 200px 内时自动加载,每个位只请求一次 -->
386
+ <div class="lazy-ad" data-app-id="your-app-id" data-ad-id="your-placement-id"></div>
387
+ ```
388
+
389
+ - **data-app-id**:应用 ID(必填)
390
+ - **data-ad-id** 或 **data-placement-id**:广告位 ID(必填)
391
+ - 同一页面可放多个 `.lazy-ad`,动态插入的也会被监听并懒加载
392
+
375
393
  ### 方式三:即插即用模式(推荐用于所有建站平台)
376
394
 
377
395
  专为**所有建站平台**设计的**零代码接入方式**,客户只需复制粘贴即可使用,无需任何技术背景。