@dolphinweex/weex-harmony 0.1.105 → 0.1.107

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.105",
3
+ "version": "0.1.107",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -127,6 +127,10 @@ export default {
127
127
  type: String,
128
128
  default: '',
129
129
  },
130
+ controls: {
131
+ type: String,
132
+ default: true,
133
+ },
130
134
  isShowTopRightViewOnPortrait: {
131
135
  type: Boolean,
132
136
  default: false,
@@ -138,6 +142,7 @@ export default {
138
142
  ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
139
143
  width: this.width,
140
144
  height: this.height,
145
+ controls: this.controls,
141
146
  onFullscreenChange: this.onFullscreenChange,
142
147
  // 视频播放器相关属性
143
148
  config: this.config,
@@ -170,6 +175,7 @@ export default {
170
175
  onStartDownload: this.onStartDownload,
171
176
  onPreviewImageClick: this.onPreviewImageClick,
172
177
  onCaptureCompletion: this.onCaptureCompletion,
178
+ onPlayerClick: this.onPlayerClick
173
179
  };
174
180
  },
175
181
  },
@@ -186,6 +192,34 @@ export default {
186
192
  });
187
193
  },
188
194
  methods: {
195
+ setSpeed(params){
196
+ // {"speed": 1}
197
+ console.log('cdj---setSpeed',JSON.stringify(params))
198
+ delete params.refId
199
+ weexModule.callNative(
200
+ 'ijkLinkApi',
201
+ {
202
+ method: 'setSpeed',
203
+ name: this.embedId,
204
+ params
205
+ },
206
+ callback
207
+ );
208
+ },
209
+ //{"progress": 221}
210
+ seek(params){
211
+ console.log('cdj---setSpseekeed',JSON.stringify(params))
212
+ delete params.refId
213
+ weexModule.callNative(
214
+ 'ijkLinkApi',
215
+ {
216
+ method: 'seek',
217
+ name: this.embedId,
218
+ params
219
+ },
220
+ callback
221
+ );
222
+ },
189
223
  captureImage(params,callback) {
190
224
  delete params.refId
191
225
  weexModule.callNative(
@@ -267,6 +301,9 @@ export default {
267
301
  },
268
302
  onCaptureCompletion(res){
269
303
  this.$emit('onCaptureCompletion', res);
304
+ },
305
+ onPlayerClick(res){
306
+ this.$emit('onPlayerClick', res);
270
307
  }
271
308
  },
272
309
  destroy(){
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <BaseSameLayer
3
+ ref="baseSameLayer"
3
4
  :hosSameLayerArgs="hosSameLayerArgs"
4
5
  embedType="native/midea-progresscycle-view"
5
6
  :defaultWidth="300"
@@ -10,6 +11,7 @@
10
11
 
11
12
  <script>
12
13
  import BaseSameLayer from "./baseSameLayer.vue";
14
+ const weexModule = weex.requireModule('weexModule');
13
15
 
14
16
  export default {
15
17
  name: "MideaProgresscycleView",
@@ -17,7 +19,9 @@ export default {
17
19
  return {
18
20
  width: 0,
19
21
  height: 0,
20
- dataVersion: 0
22
+ dataVersion: 0,
23
+ observer: null,
24
+ isVisible: false
21
25
  }
22
26
  },
23
27
  components: {
@@ -70,12 +74,75 @@ export default {
70
74
  mounted() {
71
75
  this.width = this.$el.clientWidth;
72
76
  this.height = this.$el.clientHeight;
77
+
78
+ // 初始化可见性监听
79
+ this.observeVisibility();
80
+ },
81
+ beforeDestroy() {
82
+ // 销毁前清除观察器
83
+ if (this.observer) {
84
+ this.observer.disconnect();
85
+ this.observer = null;
86
+ }
73
87
  },
74
88
 
75
89
  methods: {
76
90
  handleProgresscycleTap (res){
77
91
  this.$emit("progresscycleTap", res);
78
92
  },
93
+
94
+ /**
95
+ * 初始化可见性监听
96
+ * 使用 IntersectionObserver API 监听组件是否进入可见区域
97
+ */
98
+ observeVisibility() {
99
+ // 检查浏览器是否支持 IntersectionObserver
100
+ if (!window.IntersectionObserver) {
101
+ console.warn('[MideaProgresscycleView] IntersectionObserver is not supported');
102
+ return;
103
+ }
104
+
105
+ const options = {
106
+ root: null, // 相对于视口
107
+ rootMargin: '0px', // 不设置边距
108
+ threshold: 0.1 // 当至少 10% 的元素可见时触发
109
+ };
110
+
111
+ this.observer = new IntersectionObserver((entries) => {
112
+ entries.forEach((entry) => {
113
+ if (entry.isIntersecting) {
114
+ // 组件进入可见区域
115
+ this.onVisibilityChange(true);
116
+ } else {
117
+ // 组件离开可见区域
118
+ this.onVisibilityChange(false);
119
+ }
120
+ });
121
+ }, options);
122
+
123
+ // 开始观察该组件
124
+ if (this.$el) {
125
+ this.observer.observe(this.$el);
126
+ }
127
+ },
128
+
129
+ /**
130
+ * 可见性变化回调函数
131
+ * @param {Boolean} isVisible - 是否可见
132
+ */
133
+ onVisibilityChange(isVisible) {
134
+ this.isVisible = isVisible;
135
+ // 通过 $refs 获取子组件 BaseSameLayer 的 embedId
136
+ const componentId = this.$refs.baseSameLayer.embedId;
137
+ weexModule.callNative(
138
+ 'GlobalApi',
139
+ {
140
+ method: 'visibleChange',
141
+ componentId: componentId,
142
+ isVisible
143
+ },
144
+ );
145
+ },
79
146
  },
80
147
  };
81
148
  </script>
@@ -82,6 +82,10 @@ function traverseNode(node, parent = null, parentVForContext = false) {
82
82
 
83
83
  if (node.attributes) {
84
84
  node.attributes.forEach((attr, index) => {
85
+ //处理 简写<xxx controll></xxx> controll是null问题
86
+ if (attr.value === null && !attr.key.startsWith('v-') ) {
87
+ node.attributes[index].value = 'true';
88
+ }
85
89
  if (attr.key === 'v-bind') {
86
90
  if (isInsideVFor) {
87
91
  // v-for 场景:将 v-bind="expr" 转为 v-bind="customVBindMethodX(expr)"