@lambo-design-mobile/lambo-js-bridge 1.0.0-beta.6 → 1.0.0-beta.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/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # Changelog
2
+ ## [1.0.0-beta.7](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/js-bridge@1.0.0-beta.6...@lambo-design-mobile/js-bridge@1.0.0-beta.7) (2024-08-30)
3
+
4
+
5
+ ### 🐛 Bug Fixes | Bug 修复
6
+
7
+ * **@lambo-design-mobile/js-bridge:** 完善文档 ([5d3b7b9](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/5d3b7b928e05b65ec21008b23f9e07ddd0deff1f))
8
+ * **@lambo-dsign-mobile/js-bridge:** 修复filePreview报错 ([5d19e45](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/5d19e45f14f558323aee06dedbe6462068469e66))
9
+
2
10
  ## [1.0.0-beta.6](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/js-bridge@1.0.0-beta.5...@lambo-design-mobile/js-bridge@1.0.0-beta.6) (2024-08-29)
3
11
 
4
12
 
package/README.md CHANGED
@@ -31,10 +31,13 @@ Vue.prototype.$lamboJsBridge = lamboJsBridge;
31
31
 
32
32
  ``` javascript
33
33
  // 直接调用扫码功能
34
- Vue.prototype.$lamboJsBridge.scanCode();
34
+ // Vue方法中
35
+ this.$lamboJsBridge.scanCode()
35
36
 
37
+ //其他Js界面
38
+ Vue.prototype.$lamboJsBridge.scanCode();
36
39
  /**
37
- * 也可以自己封装一层工具类
40
+ * 也可以自己封装一层工具类
38
41
  * 扫描二维码并返回结果。(需要在APP环境下测试)
39
42
  * 此函数通过调用 Flutter scanCode.startScan 方法来启动二维码扫描。
40
43
  * 扫描成功后返回扫描结果,若扫描失败则返回错误信息。
package/demo/index.vue CHANGED
@@ -177,7 +177,7 @@ export default {
177
177
  async previewFile() {
178
178
  try {
179
179
  const options = {
180
- title: '预览文件', // 文件的标题
180
+ title: '预览文件.txt', // 文件的标题
181
181
  path: 'http://160.mall.eap.lambo.top/ecm-runtime-server/api/file/get/123456' // 文件的URL路径
182
182
  };
183
183
  const result = await this.lamboBridge.filePreview(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design-mobile/lambo-js-bridge",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -11,7 +11,7 @@ class YunTuAdapter {
11
11
  // 如果传入的是非空数组,则直接使用;否则使用默认的全部插件配置
12
12
  const configToUse = Array.isArray(pluginConfig) && pluginConfig.length > 0
13
13
  ? JSON.stringify(pluginConfig)
14
- : '["myPlugin","amapPlugin","tabBarPlugin","scanCodePlugin","filePreviewPlugin","imagePickerPlugin"]';
14
+ : '["myPlugin","tabBarPlugin","scanCodePlugin","filePreviewPlugin","imagePickerPlugin"]';
15
15
  // 调用插件初始化
16
16
  await yuntuConfig(configToUse); // 确保等待 yuntuConfig 执行完成
17
17
 
@@ -154,6 +154,34 @@ class YunTuAdapter {
154
154
  reject(new Error(errorMessage)); // ImagePicker 未初始化或不可用
155
155
  }
156
156
  });
157
+ };
158
+
159
+ async filePreview(options) {
160
+ console.log('YunTu: File preview with options', options);
161
+
162
+ if (!this.isInitialized) {
163
+ await this.initializePlugin(); // Ensure the plugin is initialized
164
+ }
165
+
166
+ return new Promise((resolve, reject) => {
167
+ if (window.filePreview && typeof window.filePreview.openFile === 'function') {
168
+ window.filePreview.openFile(
169
+ (res) => {
170
+ console.log('YunTu: File preview success', res);
171
+ resolve(res); // Successfully previewed the file
172
+ },
173
+ (err) => {
174
+ console.error('YunTu: File preview failed', err);
175
+ reject(err); // Failed to preview the file
176
+ },
177
+ JSON.stringify(options) // Pass the options as a string
178
+ );
179
+ } else {
180
+ const errorMessage = 'FilePreview is not initialized or not available';
181
+ console.error('YunTu:', errorMessage);
182
+ reject(new Error(errorMessage)); // FilePreview interface is not available
183
+ }
184
+ });
157
185
  }
158
186
 
159
187