@dolphinweex/weex-harmony 0.1.2 → 0.1.3

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.2",
3
+ "version": "0.1.3",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div v-on="filteredListeners">
3
3
  <embed
4
4
  :id="embedId"
5
5
  :type="embedType"
@@ -33,6 +33,11 @@ export default {
33
33
  required: false,
34
34
  default: 0,
35
35
  },
36
+ listenEvents:{
37
+ type: Array,
38
+ required: false,
39
+ default: [],
40
+ }
36
41
  },
37
42
  data() {
38
43
  return {
@@ -40,6 +45,17 @@ export default {
40
45
  };
41
46
  },
42
47
  computed: {
48
+ filteredListeners() {
49
+ // 指定传给父级标签的vue原生事件 尝试过外面v-on="{ 'click': $listeners.click }" 局部传但是不行
50
+ if (!this.listenEvents.length) { return {} }
51
+ const filtered = {};
52
+ Object.keys(this.$listeners).forEach(event => {
53
+ if (this.listenEvents.includes(event)) {
54
+ filtered[event] = this.$listeners[event];
55
+ }
56
+ });
57
+ return filtered;
58
+ },
43
59
  embedWidth() {
44
60
  // 如果hosSameLayerArgs.width存在且定义了,则使用该值,否则使用defaultWidth
45
61
  return this.hosSameLayerArgs.width || this.defaultWidth;
@@ -4,6 +4,8 @@
4
4
  embedType="native/midea-lottie-view"
5
5
  :defaultWidth="300"
6
6
  :defaultHeight="300"
7
+ v-on="$listeners"
8
+ :listenEvents="['click']"
7
9
  >
8
10
  </BaseSameLayer>
9
11
  </template>