@dolphinweex/weex-harmony 0.1.18 → 0.1.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphinweex/weex-harmony",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -9,22 +9,23 @@
9
9
  ],
10
10
  "scripts": {},
11
11
  "dependencies": {
12
+ "@dolphinweex/weex-harmony-transform": "^0.1.2",
13
+ "babel-eslint": "^10.0.2",
14
+ "babel-plugin-component": "^1.1.1",
15
+ "babel-plugin-transform-runtime": "^6.23.0",
16
+ "babel-preset-stage-0": "^6.24.1",
17
+ "css-loader": "^0.28.8",
12
18
  "fs-extra": "10.0.1",
19
+ "himalaya": "^1.1.0",
13
20
  "istanbul-lib-coverage": "3.2.0",
14
21
  "istanbul-lib-report": "3.0.0",
15
22
  "istanbul-reports": "3.1.5",
23
+ "lottie-web": "^5.12.2",
16
24
  "nyc": "15.1.0",
17
25
  "source-map": "0.7.4",
18
- "css-loader": "^0.28.8",
19
26
  "vue-loader": "^15.2.6",
20
27
  "vue-style-loader": "^4.1.1",
21
- "vue-template-compiler": "^2.6.11",
22
- "himalaya": "^1.1.0",
23
- "babel-eslint": "^10.0.2",
24
- "babel-plugin-component": "^1.1.1",
25
- "babel-plugin-transform-runtime": "^6.23.0",
26
- "babel-preset-stage-0": "^6.24.1",
27
- "@dolphinweex/weex-harmony-transform": "^0.1.2"
28
+ "vue-template-compiler": "^2.6.11"
28
29
  },
29
30
  "repository": {
30
31
  "type": "git",
@@ -77,6 +77,8 @@ export default {
77
77
  // 自定义拓展其它逻辑
78
78
  onPageFinish(res) {
79
79
  console.log("[web] pagefinish ", res);
80
+ this.$refs["iframe"].contentWindow.$midea_harmony_native = window.$midea_harmony_native
81
+ this.$refs["iframe"].contentWindow.postMessage(JSON.stringify(window.$midea_harmony_native), '*');
80
82
  this.$emit("pagefinish", res);
81
83
  },
82
84
  onPageStart(res) {
@@ -94,7 +96,7 @@ export default {
94
96
  onMessage(res){
95
97
  console.log("[web] onMessage ", res);
96
98
  this.$emit("message", res);
97
- }
99
+ },
98
100
  },
99
101
  watch: {
100
102
  loading(newText, oldText) {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <iframe :src="url"></iframe>
2
+ <iframe :src="url" ref="iframe"></iframe>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -51,5 +51,19 @@ export default {
51
51
  }
52
52
  );
53
53
  },
54
+ mounted() {
55
+ this.$refs["iframe"].addEventListener('load', this.onPageFinish);
56
+ window.addEventListener('message', function (event) {
57
+ document.getElementsByTagName('iframe')[0].height = event.data.height
58
+ });
59
+ },
60
+ method: {
61
+
62
+ onPageFinish() {
63
+ console.log('加载完毕🥳','----->👉', );
64
+ this.$refs["iframe"].contentWindow.$midea_harmony_native = window.$midea_harmony_native
65
+ this.$refs["iframe"].contentWindow.postMessage(JSON.stringify(data), '*');
66
+ },
67
+ }
54
68
  };
55
69
  </script>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <BaseSameLayer
3
+ :hosSameLayerArgs="hosSameLayerArgs"
4
+ embedType="native/midea-device-card-list-view"
5
+ :defaultWidth="100"
6
+ :defaultHeight="100"
7
+ ></BaseSameLayer>
8
+ </template>
9
+
10
+ <script>
11
+ import BaseSameLayer from './baseSameLayer.vue';
12
+
13
+ export default {
14
+ data() {
15
+ return {
16
+ width: 0,
17
+ height: 0,
18
+ };
19
+ },
20
+ name: 'MideaDeviceCardListView',
21
+ components: {
22
+ BaseSameLayer,
23
+ },
24
+ props: {
25
+ hosUniqueProps: {
26
+ type: Object,
27
+ default() {
28
+ return {};
29
+ },
30
+ },
31
+ data: {
32
+ type: Object,
33
+ default() {
34
+ return {};
35
+ },
36
+ },
37
+ harmonyStyle: {
38
+ type: Object,
39
+ required: false,
40
+ }
41
+ },
42
+ computed: {
43
+ hosSameLayerArgs() {
44
+ return {
45
+ ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
46
+ width: this.width,
47
+ height: (this.harmonyStyle && this.harmonyStyle.height) ? this.harmonyStyle.height : this.height,
48
+ data: this.data,
49
+ loadComplete: this.loadComplete,
50
+ };
51
+ },
52
+ },
53
+ mounted() {
54
+ this.width = this.$el.clientWidth;
55
+ this.height = this.$el.clientHeight;
56
+ },
57
+ methods: {
58
+ loadComplete(res) {
59
+ this.$emit("loadComplete", res)
60
+ },
61
+ },
62
+ };
63
+ </script>