fix(uni-app): 🐛 修复vue3没导出
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
# @r-utils/uni-app
|
||||
|
||||
仅用于 uni-app 项目的工具包,封装请求、上传、NFC、蓝牙、打印和常用 uni API 辅助方法。
|
||||
仅用于 uni-app 项目的工具包,封装请求、上传、NFC、蓝牙、打印、Vue3 Hooks 和常用 uni API 辅助方法。
|
||||
|
||||
## 适用范围
|
||||
|
||||
- 适用于 uni-app 项目(含 uni 运行时能力)。
|
||||
- 适用于需要复用请求、上传、蓝牙、NFC、打印等能力的业务项目。
|
||||
- 适用于需要复用请求、上传、蓝牙、NFC、打印、Vue3 Hooks 等能力的业务项目。
|
||||
|
||||
## 不适用范围
|
||||
|
||||
@@ -25,7 +25,7 @@ pnpm add @r-utils/uni-app
|
||||
大多数场景推荐从根入口导入,路径简单,使用心智负担更低。
|
||||
|
||||
```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 { nfcScan } from "@r-utils/uni-app/nfc";
|
||||
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/nfc` | NFC 相关工具 |
|
||||
| `@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" },
|
||||
});
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 推荐优先使用根入口导入;如果需要更精确的模块边界,也可以使用子路径导入。
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
"types": "./dist/upload/index.d.ts",
|
||||
"import": "./dist/upload/index.mjs",
|
||||
"require": "./dist/upload/index.cjs"
|
||||
},
|
||||
"./vue3": {
|
||||
"types": "./dist/vue3/index.d.ts",
|
||||
"import": "./dist/vue3/index.mjs",
|
||||
"require": "./dist/vue3/index.cjs"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
|
||||
@@ -4,3 +4,4 @@ export * from "./printer";
|
||||
export * from "./request";
|
||||
export * from "./uni-helper";
|
||||
export * from "./upload";
|
||||
export * from "./vue3";
|
||||
|
||||
@@ -19,6 +19,7 @@ export default defineConfig({
|
||||
"request/index": resolve(__dirname, "src/request/index.ts"),
|
||||
"uni-helper/index": resolve(__dirname, "src/uni-helper/index.ts"),
|
||||
"upload/index": resolve(__dirname, "src/upload/index.ts"),
|
||||
"vue3/index": resolve(__dirname, "src/vue3/index.ts"),
|
||||
},
|
||||
formats: ["es", "cjs"],
|
||||
fileName: (format, entryName) =>
|
||||
|
||||
Reference in New Issue
Block a user