@lambo-design-mobile/lambo-js-bridge 1.0.0-beta.5 → 1.0.0-beta.6
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 +7 -0
- package/README.md +51 -0
- package/package.json +1 -1
- package/src/sdk/LamboJsBridge.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [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
|
+
|
|
4
|
+
|
|
5
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
6
|
+
|
|
7
|
+
* **@lambo-design-mobile/js-bridge:** 完善全局调用文档,删除未使用代码 ([309c4af](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/309c4af613be0f8543a53e2d24c3702e44474134))
|
|
8
|
+
|
|
2
9
|
## [1.0.0-beta.5](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/js-bridge@1.0.0-beta.4...@lambo-design-mobile/js-bridge@1.0.0-beta.5) (2024-08-29)
|
|
3
10
|
|
|
4
11
|
|
package/README.md
CHANGED
|
@@ -4,6 +4,57 @@
|
|
|
4
4
|
|
|
5
5
|
LamboJsBridge 是一个js 适配sdk 用于处理H5应用和运行时环境的能力调用。支持微信、钉钉等环境。目前已适配微信(WechatAdapter)和企业微信(WeComAdapter)
|
|
6
6
|
|
|
7
|
+
### Vue 全局引入
|
|
8
|
+
|
|
9
|
+
``` javascript
|
|
10
|
+
/**
|
|
11
|
+
* Vue main.js 中加入如下代码
|
|
12
|
+
*/
|
|
13
|
+
console.log("------ 初始化 LamboJsBridge -------")
|
|
14
|
+
import LamboJsBridge from "@lambo-design-mobile/lambo-js-bridge";
|
|
15
|
+
let lamboJsBridge = new LamboJsBridge();
|
|
16
|
+
try {
|
|
17
|
+
const platformInfo = await lamboJsBridge.getPlatform(); // 获取初始化信息
|
|
18
|
+
console.log('LamboJsBridge Platform Info:', JSON.stringify(platformInfo, null, 2));
|
|
19
|
+
|
|
20
|
+
//yuntu Flutter 平台需要初始化插件
|
|
21
|
+
const pluginConfig = ["scanCodePlugin", "filePreviewPlugin", "imagePickerPlugin"]
|
|
22
|
+
const pluginConfigInfo = await lamboJsBridge.initializePlugin(pluginConfig);
|
|
23
|
+
console.log('LamboJsBridge PluginConfig Info:', pluginConfigInfo);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Error getting init info:', error);
|
|
26
|
+
}
|
|
27
|
+
// 将 lamboJsBridge 挂载到 Vue 原型上
|
|
28
|
+
Vue.prototype.$lamboJsBridge = lamboJsBridge;
|
|
29
|
+
```
|
|
30
|
+
### 调用
|
|
31
|
+
|
|
32
|
+
``` javascript
|
|
33
|
+
// 直接调用扫码功能
|
|
34
|
+
Vue.prototype.$lamboJsBridge.scanCode();
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 也可以自己封装一层工具类
|
|
38
|
+
* 扫描二维码并返回结果。(需要在APP环境下测试)
|
|
39
|
+
* 此函数通过调用 Flutter scanCode.startScan 方法来启动二维码扫描。
|
|
40
|
+
* 扫描成功后返回扫描结果,若扫描失败则返回错误信息。
|
|
41
|
+
*
|
|
42
|
+
* @returns {Promise<String>} - 返回一个 Promise,当扫描成功时 resolve,返回扫描的结果字符串;如果失败,reject 返回错误信息。
|
|
43
|
+
* @example
|
|
44
|
+
* flutterUtil.scanCode()
|
|
45
|
+
* .then(result => {
|
|
46
|
+
* console.log('扫描结果:', result.msg);
|
|
47
|
+
* })
|
|
48
|
+
* .catch(error => {
|
|
49
|
+
* console.error('扫描失败:', error.msg);
|
|
50
|
+
* });
|
|
51
|
+
*/
|
|
52
|
+
flutterUtil.scanCode = function() {
|
|
53
|
+
return Vue.prototype.$lamboJsBridge.scanCode();
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
7
58
|
### 引入
|
|
8
59
|
|
|
9
60
|
``` javascript
|
package/package.json
CHANGED
package/src/sdk/LamboJsBridge.js
CHANGED
|
@@ -4,14 +4,9 @@ import CordovaAdapter from './CordovaAdapter';
|
|
|
4
4
|
import YunTuAdapter from './YunTuAdapter';
|
|
5
5
|
import WeComAdapter from './WeComAdapter';
|
|
6
6
|
import BrowserAdapter from './BrowserAdapter';
|
|
7
|
-
import { initBdMap } from './BdMapUtils';
|
|
8
7
|
|
|
9
8
|
class LamboJsBridge {
|
|
10
9
|
constructor(param) {
|
|
11
|
-
// param.isBdNiJieXi 需要百度地图逆地址解析
|
|
12
|
-
if (param.isBdNiJieXi) {
|
|
13
|
-
initBdMap();
|
|
14
|
-
}
|
|
15
10
|
this._detectPlatform(param);
|
|
16
11
|
}
|
|
17
12
|
|