@hlw-uni/mp-vue 2.3.2 → 2.3.5

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.
@@ -0,0 +1,10 @@
1
+ export interface HlwRewardAdResult {
2
+ /** 是否播放成功 */
3
+ success: boolean;
4
+ /** 广告是否完整播放结束 */
5
+ isEnded: boolean;
6
+ /** 广告加载是否失败 */
7
+ loadFailed?: boolean;
8
+ /** 加载/播放失败时的错误对象 */
9
+ err?: any;
10
+ }
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from './core';
11
11
  export * from './utils';
12
12
  export type { HlwMenuItem } from './components/hlw-menu/types';
13
13
  export type { HlwPagingRef, HlwPagingInstance } from './components/hlw-paging/types';
14
+ export type { HlwRewardAdResult } from './components/hlw-reward-ad/types';
14
15
  export { useApp } from './app';
15
16
  export { hlw, type HlwInstance } from './hlw';
16
17
  export { vCopy } from './directives';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hlw-uni/mp-vue",
3
- "version": "2.3.2",
3
+ "version": "2.3.5",
4
4
  "description": "hlw-uni工具集",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,12 +1,11 @@
1
1
  <template>
2
- <view class="hlw-reward-ad" @tap="handleClick">
3
- <slot />
4
- </view>
2
+ <view class="hlw-reward-ad" />
5
3
  </template>
6
4
 
7
5
  <script setup lang="ts">
8
6
  import { ref, onUnmounted } from "vue";
9
7
  import { setRewardAd, showRewardAd, confirmRewardAd, destroyRewardAd } from "../../utils/ad";
8
+ import type { HlwRewardAdResult } from "./types";
10
9
 
11
10
  defineOptions({ name: "HlwRewardAd" });
12
11
 
@@ -18,7 +17,7 @@ interface Props {
18
17
  const props = defineProps<Props>();
19
18
 
20
19
  const emit = defineEmits<{
21
- (e: "onHandle", res: { success: boolean; isEnded: boolean; loadFailed?: boolean; err?: any }): void;
20
+ (e: "onHandle", res: HlwRewardAdResult): void;
22
21
  }>();
23
22
 
24
23
  // 点击锁定状态,防止连续多次点击重复触发广告
@@ -92,21 +91,6 @@ async function playRewardAdFlow(): Promise<void> {
92
91
  }
93
92
  }
94
93
 
95
- async function handleClick() {
96
- if (isClicked.value) return;
97
- if (!props.unitId) {
98
- console.warn("[HlwRewardAd] unitId is required but empty.");
99
- return;
100
- }
101
-
102
- isClicked.value = true;
103
- try {
104
- await playRewardAdFlow();
105
- } finally {
106
- isClicked.value = false;
107
- }
108
- }
109
-
110
94
  /**
111
95
  * Expose a method for parent components to open the reward ad programmatically via ref.
112
96
  * Usage: const adRef = ref(null);
@@ -136,7 +120,6 @@ onUnmounted(() => {
136
120
 
137
121
  <style scoped>
138
122
  .hlw-reward-ad {
139
- display: block;
140
- width: 100%;
123
+ display: none;
141
124
  }
142
125
  </style>
@@ -0,0 +1,10 @@
1
+ export interface HlwRewardAdResult {
2
+ /** 是否播放成功 */
3
+ success: boolean;
4
+ /** 广告是否完整播放结束 */
5
+ isEnded: boolean;
6
+ /** 广告加载是否失败 */
7
+ loadFailed?: boolean;
8
+ /** 加载/播放失败时的错误对象 */
9
+ err?: any;
10
+ }
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export * from "./utils";
15
15
  // 类型
16
16
  export type { HlwMenuItem } from "./components/hlw-menu/types";
17
17
  export type { HlwPagingRef, HlwPagingInstance } from "./components/hlw-paging/types";
18
+ export type { HlwRewardAdResult } from "./components/hlw-reward-ad/types";
18
19
 
19
20
  // App 根上下文
20
21
  export { useApp } from "./app";