qsh-webview-sdk 2.4.6 → 2.4.7
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 +3 -1
- package/dist/index.d.ts +4 -0
- package/dist/qsh-webview-sdk.es.js +690 -671
- package/dist/qsh-webview-sdk.es.js.map +1 -1
- package/dist/qsh-webview-sdk.umd.js +1 -1
- package/dist/qsh-webview-sdk.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -639,6 +639,7 @@ qsh.printPdf({
|
|
|
639
639
|
```javascript
|
|
640
640
|
qsh.filePreview({
|
|
641
641
|
url: 'https://example.com/files/demo.pdf', // 文件地址
|
|
642
|
+
fileType: 'pdf', // 文件类型
|
|
642
643
|
showMenu: true, // 是否显示右上角菜单,默认 false
|
|
643
644
|
success: (res) => console.log('文件预览请求成功', res),
|
|
644
645
|
fail: (err) => console.error('文件预览失败:', err)
|
|
@@ -647,11 +648,12 @@ qsh.filePreview({
|
|
|
647
648
|
// Promise 用法
|
|
648
649
|
await qsh.filePreviewAsync({
|
|
649
650
|
url: 'https://example.com/files/demo.pdf',
|
|
651
|
+
fileType: 'pdf',
|
|
650
652
|
showMenu: false
|
|
651
653
|
});
|
|
652
654
|
```
|
|
653
655
|
|
|
654
|
-
>
|
|
656
|
+
> `fileType` 仅支持以下取值:`doc`、`xls`、`ppt`、`pdf`、`docx`、`xlsx`、`pptx`。
|
|
655
657
|
> 微信小程序 `web-view` 下,SDK 会通过 `wx.miniProgram.postMessage` 把预览请求投递给宿主,再调用 `wx.miniProgram.navigateBack` 返回基座;APP 端通过 `callApiInWebView` 调用基座能力。
|
|
656
658
|
|
|
657
659
|
### 跳转其他微信小程序
|
package/dist/index.d.ts
CHANGED
|
@@ -54,9 +54,13 @@ declare namespace UniWebView {
|
|
|
54
54
|
[key: string]: any;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
type FilePreviewType = "doc" | "xls" | "ppt" | "pdf" | "docx" | "xlsx" | "pptx";
|
|
58
|
+
|
|
57
59
|
interface FilePreviewOptions {
|
|
58
60
|
/** file url */
|
|
59
61
|
url: string;
|
|
62
|
+
/** file type */
|
|
63
|
+
fileType: FilePreviewType;
|
|
60
64
|
/** whether to show the top-right menu */
|
|
61
65
|
showMenu?: boolean;
|
|
62
66
|
/** success callback */
|