4 Commits

Author SHA1 Message Date
TianSL 4759dfe6b2 fix(uni-app): 🐛 修复vue3没导出 2026-05-29 20:01:09 +08:00
TianSL f9eb267988 chore: 🔨 发布版本 2026-05-28 12:00:13 +08:00
TianSL 18a037e9b7 fix(uni-app): 🐛 安装类型依赖 2026-05-28 11:54:22 +08:00
TianSL 80debf6d6b chore: 🔨 发布v2.0.0 2026-05-28 11:46:59 +08:00
19 changed files with 133 additions and 10 deletions
+1
View File
@@ -1 +1,2 @@
registry=http://npm.nps.yunvip123.cn
engine-strict=true engine-strict=true
+4 -1
View File
@@ -8,7 +8,7 @@
| ---- | ---- | ---- | | ---- | ---- | ---- |
| `@r-utils/common` | `packages/common` | 通用 JS/TS 工具(权限、倒计时、打印、时间等) | | `@r-utils/common` | `packages/common` | 通用 JS/TS 工具(权限、倒计时、打印、时间等) |
| `@r-utils/vue3` | `packages/vue3` | Vue3 工具(class 处理、dispatch 等) | | `@r-utils/vue3` | `packages/vue3` | Vue3 工具(class 处理、dispatch 等) |
| `@r-utils/uni-app` | `packages/uni-app` | uni-app 工具(请求封装、蓝牙、NFC、打印等) | | `@r-utils/uni-app` | `packages/uni-app` | uni-app 工具(请求封装、蓝牙、NFC、打印、Vue3 Hooks 等) |
| `@r-utils/uview-plus` | `packages/uview-plus` | uview-plus 组合式 API HooksPicker、Calendar 等) | | `@r-utils/uview-plus` | `packages/uview-plus` | uview-plus 组合式 API HooksPicker、Calendar 等) |
| `@r-utils/vue2` | `packages/vue2` | Vue2 工具(visibility 插件) | | `@r-utils/vue2` | `packages/vue2` | Vue2 工具(visibility 插件) |
@@ -86,6 +86,9 @@ import { mergeClass, dispatch } from '@r-utils/vue3';
// uni-app 工具 // uni-app 工具
import { Request } from '@r-utils/uni-app'; import { Request } from '@r-utils/uni-app';
// uni-app Vue3 Hooks
import { useShare } from '@r-utils/uni-app/vue3';
// uview-plus Hooks // uview-plus Hooks
import { usePickerSingle, usePicker, useCalendar } from '@r-utils/uview-plus'; import { usePickerSingle, usePicker, useCalendar } from '@r-utils/uview-plus';
+6
View File
@@ -1,5 +1,11 @@
# @r-utils/common # @r-utils/common
## 2.0.0
### Major Changes
- 添加工具
## 1.4.0 ## 1.4.0
### Minor Changes ### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@r-utils/common", "name": "@r-utils/common",
"version": "1.4.0", "version": "2.0.0",
"private": false, "private": false,
"description": "js通用工具库", "description": "js通用工具库",
"type": "module", "type": "module",
+17
View File
@@ -1,5 +1,22 @@
# @r-utils/uni-app # @r-utils/uni-app
## 2.0.1
### Patch Changes
- 修复类型问题
## 2.0.0
### Major Changes
- 添加工具
### Patch Changes
- Updated dependencies
- @r-utils/common@2.0.0
## 1.4.0 ## 1.4.0
### Minor Changes ### Minor Changes
+16 -3
View File
@@ -1,11 +1,11 @@
# @r-utils/uni-app # @r-utils/uni-app
仅用于 uni-app 项目的工具包,封装请求、上传、NFC、蓝牙、打印和常用 uni API 辅助方法。 仅用于 uni-app 项目的工具包,封装请求、上传、NFC、蓝牙、打印、Vue3 Hooks 和常用 uni API 辅助方法。
## 适用范围 ## 适用范围
- 适用于 uni-app 项目(含 uni 运行时能力)。 - 适用于 uni-app 项目(含 uni 运行时能力)。
- 适用于需要复用请求、上传、蓝牙、NFC、打印等能力的业务项目。 - 适用于需要复用请求、上传、蓝牙、NFC、打印、Vue3 Hooks 等能力的业务项目。
## 不适用范围 ## 不适用范围
@@ -25,7 +25,7 @@ pnpm add @r-utils/uni-app
大多数场景推荐从根入口导入,路径简单,使用心智负担更低。 大多数场景推荐从根入口导入,路径简单,使用心智负担更低。
```ts ```ts
import { Request, showToast, toPromise, upload, Printer } from "@r-utils/uni-app"; import { Request, showToast, toPromise, upload, Printer, useShare } from "@r-utils/uni-app";
``` ```
### 兼容:子路径导入 ### 兼容:子路径导入
@@ -39,6 +39,7 @@ import { upload } from "@r-utils/uni-app/upload";
import { Printer } from "@r-utils/uni-app/printer"; import { Printer } from "@r-utils/uni-app/printer";
import { nfcScan } from "@r-utils/uni-app/nfc"; import { nfcScan } from "@r-utils/uni-app/nfc";
import { BluetoothUtils } from "@r-utils/uni-app/bluetooth-utils"; import { BluetoothUtils } from "@r-utils/uni-app/bluetooth-utils";
import { useShare, usePageTab, useTopSticky } from "@r-utils/uni-app/vue3";
``` ```
## 导出模块 ## 导出模块
@@ -51,6 +52,7 @@ import { BluetoothUtils } from "@r-utils/uni-app/bluetooth-utils";
| `@r-utils/uni-app/printer` | 打印机相关工具 | | `@r-utils/uni-app/printer` | 打印机相关工具 |
| `@r-utils/uni-app/nfc` | NFC 相关工具 | | `@r-utils/uni-app/nfc` | NFC 相关工具 |
| `@r-utils/uni-app/bluetooth-utils` | 蓝牙相关工具 | | `@r-utils/uni-app/bluetooth-utils` | 蓝牙相关工具 |
| `@r-utils/uni-app/vue3` | uni-app Vue3 Hooks |
## 使用示例 ## 使用示例
@@ -86,6 +88,17 @@ const request = new Request({
}); });
``` ```
### 使用 Vue3 Hooks
```ts
import { useShare } from "@r-utils/uni-app/vue3";
const { getShareOptions } = useShare({
title: "页面标题",
query: { id: "1" },
});
```
## 注意事项 ## 注意事项
- 推荐优先使用根入口导入;如果需要更精确的模块边界,也可以使用子路径导入。 - 推荐优先使用根入口导入;如果需要更精确的模块边界,也可以使用子路径导入。
+7 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@r-utils/uni-app", "name": "@r-utils/uni-app",
"version": "1.4.0", "version": "2.0.1",
"private": false, "private": false,
"description": "uni-app工具库", "description": "uni-app工具库",
"type": "module", "type": "module",
@@ -46,6 +46,11 @@
"types": "./dist/upload/index.d.ts", "types": "./dist/upload/index.d.ts",
"import": "./dist/upload/index.mjs", "import": "./dist/upload/index.mjs",
"require": "./dist/upload/index.cjs" "require": "./dist/upload/index.cjs"
},
"./vue3": {
"types": "./dist/vue3/index.d.ts",
"import": "./dist/vue3/index.mjs",
"require": "./dist/vue3/index.cjs"
} }
}, },
"keywords": [ "keywords": [
@@ -83,6 +88,7 @@
"test": "vitest run" "test": "vitest run"
}, },
"dependencies": { "dependencies": {
"@jonny1994/qqmap-wx-jssdk": "^1.4.0",
"@r-utils/common": "workspace:^", "@r-utils/common": "workspace:^",
"chroma-js": "catalog:", "chroma-js": "catalog:",
"lodash-es": "catalog:", "lodash-es": "catalog:",
+1
View File
@@ -4,3 +4,4 @@ export * from "./printer";
export * from "./request"; export * from "./request";
export * from "./uni-helper"; export * from "./uni-helper";
export * from "./upload"; export * from "./upload";
export * from "./vue3";
+42
View File
@@ -1,3 +1,45 @@
declare namespace WechatMiniprogram {
/** 微信小程序 NFC 适配器 */
interface NFCAdapter {
/** 开始监听 NFC 标签发现事件 */
startDiscovery(options?: {
/** 启动成功回调 */
success?: (res: NFCError) => void;
/** 启动失败回调 */
fail?: (res: NFCError) => void;
}): void;
/** 停止监听 NFC 标签发现事件 */
stopDiscovery(options?: {
/** 停止成功回调 */
success?: (res: NFCError) => void;
/** 停止失败回调 */
fail?: (res: NFCError) => void;
}): void;
/** 注册 NFC 标签发现回调 */
onDiscovered(callback: (res: OnDiscoveredCallbackResult) => void): void;
/** 取消注册 NFC 标签发现回调 */
offDiscovered(callback?: (res: OnDiscoveredCallbackResult) => void): void;
}
/** 微信小程序 NFC 操作结果 */
interface NFCError {
/** 错误码 */
errCode?: number;
/** 错误信息 */
errMsg?: string;
}
/** 微信小程序 NFC 标签发现结果 */
interface OnDiscoveredCallbackResult {
/** NFC 标签 ID */
id: ArrayBuffer;
/** NFC 标签消息列表 */
messages?: unknown[];
/** NFC 支持的技术列表 */
techs?: string[];
}
}
export function startNfcScan(): Promise<number[]>; export function startNfcScan(): Promise<number[]>;
export class WeixinNfcUtil { export class WeixinNfcUtil {
+1
View File
@@ -19,6 +19,7 @@ export default defineConfig({
"request/index": resolve(__dirname, "src/request/index.ts"), "request/index": resolve(__dirname, "src/request/index.ts"),
"uni-helper/index": resolve(__dirname, "src/uni-helper/index.ts"), "uni-helper/index": resolve(__dirname, "src/uni-helper/index.ts"),
"upload/index": resolve(__dirname, "src/upload/index.ts"), "upload/index": resolve(__dirname, "src/upload/index.ts"),
"vue3/index": resolve(__dirname, "src/vue3/index.ts"),
}, },
formats: ["es", "cjs"], formats: ["es", "cjs"],
fileName: (format, entryName) => fileName: (format, entryName) =>
+6
View File
@@ -1,5 +1,11 @@
# @r-utils/uview-plus # @r-utils/uview-plus
## 2.0.0
### Major Changes
- 添加工具
## 1.3.0 ## 1.3.0
### Minor Changes ### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@r-utils/uview-plus", "name": "@r-utils/uview-plus",
"version": "1.3.0", "version": "2.0.0",
"private": false, "private": false,
"description": "uview-plus 组合式 API Hooks", "description": "uview-plus 组合式 API Hooks",
"type": "module", "type": "module",
+12
View File
@@ -1,5 +1,17 @@
# @r-utils/vue2 # @r-utils/vue2
## 2.0.1
### Patch Changes
- 修复类型问题
## 2.0.0
### Major Changes
- 添加工具
## 1.4.0 ## 1.4.0
### Minor Changes ### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@r-utils/vue2", "name": "@r-utils/vue2",
"version": "1.4.0", "version": "2.0.1",
"private": false, "private": false,
"description": "Vue2工具库", "description": "Vue2工具库",
"type": "module", "type": "module",
+1 -1
View File
@@ -14,7 +14,7 @@ declare module "vue/types/options" {
export declare function install(Vue: VueConstructor): void; export declare function install(Vue: VueConstructor): void;
/** 页面可见性生命周期插件 */ /** 页面可见性生命周期插件 */
declare const VisibilityPlugin: PluginObject<never> & { declare const VisibilityPlugin: PluginObject<unknown> & {
/** 安装页面可见性生命周期插件 */ /** 安装页面可见性生命周期插件 */
install: typeof install; install: typeof install;
}; };
+11
View File
@@ -1,5 +1,16 @@
# @r-utils/vue3 # @r-utils/vue3
## 2.0.0
### Major Changes
- 添加工具
### Patch Changes
- Updated dependencies
- @r-utils/common@2.0.0
## 1.4.0 ## 1.4.0
### Minor Changes ### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@r-utils/vue3", "name": "@r-utils/vue3",
"version": "1.4.0", "version": "2.0.0",
"private": false, "private": false,
"description": "Vue3 工具", "description": "Vue3 工具",
"type": "module", "type": "module",
+1
View File
@@ -3,6 +3,7 @@ import { ComponentPublicInstance } from "vue";
type CustomClassObj = Record<string, boolean>; type CustomClassObj = Record<string, boolean>;
type CustomClass = string | Array<string> | CustomClassObj; type CustomClass = string | Array<string> | CustomClassObj;
type DistCustomClass = Record<string, true>; type DistCustomClass = Record<string, true>;
export function createCustomClassObj(customClass: string): DistCustomClass; export function createCustomClassObj(customClass: string): DistCustomClass;
export function createCustomClassObj( export function createCustomClassObj(
customClass: Array<string>, customClass: Array<string>,
+3
View File
@@ -153,6 +153,9 @@ importers:
packages/uni-app: packages/uni-app:
dependencies: dependencies:
'@jonny1994/qqmap-wx-jssdk':
specifier: ^1.4.0
version: 1.4.0
'@r-utils/common': '@r-utils/common':
specifier: workspace:^ specifier: workspace:^
version: link:../common version: link:../common