@hlw-uni/mp-vue 2.1.70 → 2.1.97
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 +230 -386
- package/dist/app.d.ts +1 -1
- package/dist/core/index.d.ts +3 -0
- package/dist/core/{theme.d.ts → theme/index.d.ts} +6 -1
- package/dist/hlw.d.ts +1 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +834 -804
- package/dist/index.mjs +836 -806
- package/dist/utils/ad/index.d.ts +61 -0
- package/dist/{composables/utils → utils/common}/index.d.ts +1 -24
- package/dist/{composables → utils}/device/index.d.ts +7 -8
- package/dist/utils/index.d.ts +5 -0
- package/dist/{composables → utils}/navigator/index.d.ts +14 -30
- package/dist/{composables → utils}/request/client.d.ts +2 -8
- package/dist/{composables → utils}/request/index.d.ts +1 -1
- package/dist/{composables → utils}/request/service.d.ts +2 -2
- package/package.json +1 -1
- package/src/app.ts +2 -2
- package/src/components/hlw-add-mini/README.md +56 -9
- package/src/components/hlw-add-mini/index.vue +12 -9
- package/src/components/hlw-avatar-upload/index.vue +103 -0
- package/src/components/hlw-back-top/index.vue +1 -1
- package/src/components/hlw-button/index.vue +5 -16
- package/src/components/hlw-canvas/index.vue +7 -7
- package/src/components/hlw-cell/index.vue +1 -1
- package/src/components/{hlw-custom/hlw-custom.vue → hlw-custom-service/hlw-custom-service.vue} +27 -15
- package/src/components/hlw-empty/index.vue +14 -0
- package/src/components/hlw-header/index.vue +1 -1
- package/src/components/hlw-menu/index.vue +40 -37
- package/src/components/hlw-nav-bar/index.vue +23 -8
- package/src/components/hlw-nickname/index.vue +185 -0
- package/src/components/hlw-notice-bar/index.vue +23 -0
- package/src/components/hlw-page/index.vue +19 -1
- package/src/components/hlw-paging/index.vue +36 -0
- package/src/components/hlw-popup/index.vue +23 -0
- package/src/components/hlw-reward-ad/index.vue +133 -0
- package/src/components/hlw-search/index.vue +25 -0
- package/src/components/hlw-sheet/index.vue +1 -1
- package/src/components/hlw-status-bar/index.vue +113 -0
- package/src/components/hlw-tag/index.vue +22 -0
- package/src/core/index.ts +3 -0
- package/src/{composables → core}/msg/index.ts +0 -1
- package/src/{composables → core}/refs/index.ts +0 -1
- package/src/core/theme/index.ts +115 -0
- package/src/hlw.ts +1 -21
- package/src/index.ts +3 -11
- package/src/utils/ad/README.md +114 -0
- package/src/utils/ad/index.ts +234 -0
- package/src/{composables/utils → utils/common}/index.ts +1 -27
- package/src/{composables → utils}/device/index.ts +13 -21
- package/src/utils/index.ts +5 -0
- package/src/{composables → utils}/navigator/index.ts +30 -31
- package/src/{composables → utils}/request/client.ts +3 -11
- package/src/{composables → utils}/request/index.ts +1 -1
- package/src/{composables → utils}/request/service.ts +5 -6
- package/src/{composables → utils}/request/types.ts +0 -1
- package/dist/composables/ad/index.d.ts +0 -42
- package/dist/composables/index.d.ts +0 -11
- package/src/composables/ad/README.md +0 -58
- package/src/composables/ad/index.ts +0 -227
- package/src/composables/device/README.md +0 -50
- package/src/composables/index.ts +0 -38
- package/src/composables/msg/README.md +0 -79
- package/src/composables/navigator/README.md +0 -71
- package/src/composables/refs/README.md +0 -40
- package/src/composables/request/README.md +0 -124
- package/src/composables/share/README.md +0 -53
- package/src/composables/utils/README.md +0 -81
- package/src/core/theme.ts +0 -62
- /package/dist/{composables → core}/msg/index.d.ts +0 -0
- /package/dist/{composables → core}/refs/index.d.ts +0 -0
- /package/dist/{composables → core}/share/index.d.ts +0 -0
- /package/dist/{composables → utils}/request/adapters/alist.d.ts +0 -0
- /package/dist/{composables → utils}/request/adapters/base.d.ts +0 -0
- /package/dist/{composables → utils}/request/adapters/cos.d.ts +0 -0
- /package/dist/{composables → utils}/request/adapters/index.d.ts +0 -0
- /package/dist/{composables → utils}/request/adapters/oss.d.ts +0 -0
- /package/dist/{composables → utils}/request/adapters/qiniu.d.ts +0 -0
- /package/dist/{composables → utils}/request/types.d.ts +0 -0
- /package/src/{composables → core}/share/index.ts +0 -0
- /package/src/{composables → utils}/request/adapters/alist.ts +0 -0
- /package/src/{composables → utils}/request/adapters/base.ts +0 -0
- /package/src/{composables → utils}/request/adapters/cos.ts +0 -0
- /package/src/{composables → utils}/request/adapters/index.ts +0 -0
- /package/src/{composables → utils}/request/adapters/oss.ts +0 -0
- /package/src/{composables → utils}/request/adapters/qiniu.ts +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# share 调用文档
|
|
2
|
-
|
|
3
|
-
`useShare` 注册微信小程序分享给好友和分享到朋友圈,并尝试打开分享菜单。
|
|
4
|
-
|
|
5
|
-
## 引入
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
import { useShare } from "@hlw-uni/mp-vue";
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 基础用法
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
useShare({
|
|
15
|
-
title: "好用的小程序",
|
|
16
|
-
path: "/pages/index/index?from=share",
|
|
17
|
-
imageUrl: "https://example.com/share.png",
|
|
18
|
-
});
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## 动态分享内容
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
const share = useShare(() => ({
|
|
25
|
-
title: detail.value.title,
|
|
26
|
-
path: `/pages/detail/index?id=${detail.value.id}`,
|
|
27
|
-
imageUrl: detail.value.cover,
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
share.onShareAppMessage({
|
|
31
|
-
title: "覆盖好友分享标题",
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## API
|
|
36
|
-
|
|
37
|
-
| 方法 | 说明 |
|
|
38
|
-
| --- | --- |
|
|
39
|
-
| `onShareAppMessage(config?)` | 注册好友分享 |
|
|
40
|
-
| `onShareTimeline(config?)` | 注册朋友圈分享 |
|
|
41
|
-
| `showShareMenu()` | 主动显示分享菜单 |
|
|
42
|
-
|
|
43
|
-
同一个 `useShare` 实例中,好友分享和朋友圈分享各只注册一次。
|
|
44
|
-
|
|
45
|
-
## ShareConfig
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
interface ShareConfig {
|
|
49
|
-
title?: string;
|
|
50
|
-
path?: string;
|
|
51
|
-
imageUrl?: string;
|
|
52
|
-
}
|
|
53
|
-
```
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# utils 调用文档
|
|
2
|
-
|
|
3
|
-
`useUtils` 提供剪贴板、下载、保存相册、query 拼接和基础类型转换工具。
|
|
4
|
-
|
|
5
|
-
## 引入
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
import { useUtils } from "@hlw-uni/mp-vue";
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 基础用法
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
const utils = useUtils();
|
|
15
|
-
|
|
16
|
-
await utils.copy("要复制的文本");
|
|
17
|
-
const text = await utils.paste();
|
|
18
|
-
|
|
19
|
-
const qs = utils.toQuery({ id: 1, keyword: "测试" });
|
|
20
|
-
const url = utils.withQuery("/pages/search/index", qs);
|
|
21
|
-
|
|
22
|
-
const age = utils.toNumber("18", 0);
|
|
23
|
-
const enabled = utils.toBoolean("1", false);
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## 下载和保存
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
const res = await utils.download({
|
|
30
|
-
url: "https://example.com/a.png",
|
|
31
|
-
progress: (value, done, total) => {
|
|
32
|
-
console.log(value, done, total);
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
if (res.ok && res.path) {
|
|
37
|
-
await utils.saveImage(res.path);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
await utils.saveImageUrl("https://example.com/a.png");
|
|
41
|
-
await utils.saveVideoUrl("https://example.com/a.mp4");
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## API
|
|
45
|
-
|
|
46
|
-
| 方法 | 说明 |
|
|
47
|
-
| --- | --- |
|
|
48
|
-
| `withQuery(url, qs)` | 为 URL 追加 query |
|
|
49
|
-
| `toQuery(data)` | 对象转 URL query |
|
|
50
|
-
| `signText(url)` | 生成签名原文,query 会排序 |
|
|
51
|
-
| `toNumber(value, defaultValue)` | 安全转数字 |
|
|
52
|
-
| `toBoolean(value, defaultValue)` | 安全转布尔 |
|
|
53
|
-
| `copy(text, tip?)` | 复制文本 |
|
|
54
|
-
| `paste()` | 读取剪贴板 |
|
|
55
|
-
| `saveImage(path)` | 保存本地图片到相册 |
|
|
56
|
-
| `saveVideo(path)` | 保存本地视频到相册 |
|
|
57
|
-
| `download(options)` | 下载文件 |
|
|
58
|
-
| `saveImageUrl(url, progress?)` | 下载远程图片并保存 |
|
|
59
|
-
| `saveVideoUrl(url, progress?)` | 下载远程视频并保存 |
|
|
60
|
-
|
|
61
|
-
## DownloadOpt
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
interface DownloadOpt {
|
|
65
|
-
url: string;
|
|
66
|
-
path?: string;
|
|
67
|
-
header?: Record<string, string>;
|
|
68
|
-
progress?: (value: number, done: number, total: number) => void;
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## DownloadRes
|
|
73
|
-
|
|
74
|
-
```ts
|
|
75
|
-
interface DownloadRes {
|
|
76
|
-
ok: boolean;
|
|
77
|
-
path?: string;
|
|
78
|
-
code?: number;
|
|
79
|
-
msg?: string;
|
|
80
|
-
}
|
|
81
|
-
```
|
package/src/core/theme.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
|
-
import type { ComputedRef } from "vue";
|
|
3
|
-
import {
|
|
4
|
-
useThemeStore,
|
|
5
|
-
themePresets,
|
|
6
|
-
fontSizePresets,
|
|
7
|
-
fontFamilyPresets
|
|
8
|
-
} from "../stores/theme";
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
themePresets,
|
|
12
|
-
type ThemePreset,
|
|
13
|
-
fontSizePresets,
|
|
14
|
-
type FontSizePreset,
|
|
15
|
-
fontFamilyPresets,
|
|
16
|
-
type FontFamilyPreset
|
|
17
|
-
} from "../stores/theme";
|
|
18
|
-
|
|
19
|
-
// ==========================================
|
|
20
|
-
// 统一个性化外观配置 Hook (useTheme)
|
|
21
|
-
// ==========================================
|
|
22
|
-
|
|
23
|
-
export function useTheme() {
|
|
24
|
-
const store = useThemeStore();
|
|
25
|
-
|
|
26
|
-
// 主题
|
|
27
|
-
const theme: ComputedRef<string> = computed(() => store.theme);
|
|
28
|
-
|
|
29
|
-
// 字体大小
|
|
30
|
-
const fontSize: ComputedRef<string> = computed(() => store.fontSize);
|
|
31
|
-
const fontSizeClass: ComputedRef<string> = computed(() => {
|
|
32
|
-
const found = fontSizePresets.find((p) => p.id === store.fontSize);
|
|
33
|
-
return found ? found.class : "font-size-standard";
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 字体样式
|
|
37
|
-
const fontFamily: ComputedRef<string> = computed(() => store.fontFamily);
|
|
38
|
-
const fontFamilyClass: ComputedRef<string> = computed(() => {
|
|
39
|
-
const found = fontFamilyPresets.find((p) => p.id === store.fontFamily);
|
|
40
|
-
return found ? found.class : "font-family-system";
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// 动作方法
|
|
44
|
-
function setFontSize(size: string): void {
|
|
45
|
-
store.setFontSize(size);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function setFontFamily(font: string): void {
|
|
49
|
-
store.setFontFamily(font);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
theme,
|
|
54
|
-
fontSize,
|
|
55
|
-
fontSizeClass,
|
|
56
|
-
setFontSize,
|
|
57
|
-
fontFamily,
|
|
58
|
-
fontFamilyClass,
|
|
59
|
-
setFontFamily,
|
|
60
|
-
store,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|