@dolphinweex/weex-harmony 0.1.56 → 0.1.58

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.56",
3
+ "version": "0.1.58",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -53,7 +53,6 @@ export default {
53
53
  startX: 0,
54
54
  startY: 0,
55
55
  isHorizontalScroll: false,
56
- embedId: `embed_${this._uid}`, // 使用Vue实例的唯一ID来生成embed元素的唯一ID
57
56
  };
58
57
  },
59
58
  computed: {
@@ -70,6 +69,7 @@ export default {
70
69
  }
71
70
  },
72
71
  created() {
72
+ this.embedId = `embedId_${this._uid}_${this.generateNaiveId()}`
73
73
  console.log("[sameLayerRendering] web component created.");
74
74
  weexModule.callNative("transferSameLayerArgs", {
75
75
  componentId: this.embedId,
@@ -85,6 +85,9 @@ export default {
85
85
  this.removeTouchEvent();
86
86
  },
87
87
  methods: {
88
+ generateNaiveId() {
89
+ return Date.now().toString(36) + Math.random().toString(36).substring(2);
90
+ },
88
91
  // 记录起始触摸位置
89
92
  handleTouchStart(e) {
90
93
  this.startX = e.changedTouches[0].clientX;
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <iframe :src="url" ref="iframe" @load="onPageFinish"></iframe>
2
+ <div>
3
+ <!-- <text v-if="progressText.length > 0">{{progressText}}</text> -->
4
+ <iframe class="common-view-iframe" v-if="url.length > 0" :src="url" :style="{backgroundColor: backgroundColor}" ref="iframe" @load="onPageFinish"></iframe>
5
+ <!-- <image v-if="progressText.length > 0" /> -->
6
+ </div>
3
7
  </template>
4
8
 
5
9
  <script>
@@ -10,6 +14,7 @@ export default {
10
14
  return {
11
15
  url: "",
12
16
  backgroundColor: "transparent",
17
+ progressText: ""
13
18
  };
14
19
  },
15
20
  name: "MideaCommonWeexView",
@@ -33,6 +38,11 @@ export default {
33
38
  type: Object,
34
39
  },
35
40
  },
41
+ // watch:{
42
+ // backgroundColor(oldColor, newColor){
43
+ // this.$refs["iframe"].contentWindow.document.style.backgroundColor = newColor
44
+ // }
45
+ // },
36
46
  created() {
37
47
  weexModule.callNative(
38
48
  `webview.webHandle`,
@@ -44,10 +54,12 @@ export default {
44
54
  pluginData: this.pluginData,
45
55
  },
46
56
  (args) => {
47
- console.log(args);
48
-
49
- this.url = args.url;
50
- this.backgroundColor = args.pageBackgroundColor;
57
+ if (args.progressText){
58
+ this.progressText = args.progressText;
59
+ } else if (args.url) {
60
+ this.url = args.url;
61
+ this.backgroundColor = args.pageBackgroundColor;
62
+ }
51
63
  }
52
64
  );
53
65
  },
@@ -59,10 +71,18 @@ export default {
59
71
  },
60
72
  methods: {
61
73
  onPageFinish() {
62
- this.$refs["iframe"].contentWindow.$midea_harmony_native = window.$midea_harmony_native;
63
- this.$refs["iframe"].contentWindow.isIframe = true;
64
- this.$refs["iframe"].contentWindow.postMessage(JSON.stringify(window.$midea_harmony_native), '*');
74
+ if (this.$refs["iframe"]) {
75
+ this.$refs["iframe"].contentWindow.$midea_harmony_native = window.$midea_harmony_native;
76
+ this.$refs["iframe"].contentWindow.isIframe = true;
77
+ this.$refs["iframe"].contentWindow.postMessage(JSON.stringify(window.$midea_harmony_native), '*');
78
+ }
65
79
  },
66
80
  }
67
81
  };
68
82
  </script>
83
+
84
+ <style scoped>
85
+ .common-view-iframe{
86
+ height: 100%
87
+ }
88
+ </style>
@@ -55,8 +55,8 @@ export default {
55
55
  type: Boolean,
56
56
  default: true,
57
57
  },
58
- scale: {
59
- type: Object,
58
+ load: {
59
+ type: Function,
60
60
  default: ()=>{},
61
61
  },
62
62
  },
@@ -72,7 +72,7 @@ export default {
72
72
  repeatCount: this.repeatCount,
73
73
  progress: this.progress,
74
74
  autoPlay: this.autoPlay,
75
- scale: this.scale
75
+ load: this.load
76
76
  };
77
77
  },
78
78
  },
@@ -82,6 +82,9 @@ export default {
82
82
  },
83
83
 
84
84
  methods: {
85
+ load(){
86
+ this.$emit("load");
87
+ },
85
88
  // 自定义拓展其它逻辑
86
89
  handleOnChange(res) {
87
90
  if (res.mode == 1) {