@dolphinweex/weex-harmony 0.1.78 → 0.1.80

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.78",
3
+ "version": "0.1.80",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -40,7 +40,7 @@ export default {
40
40
  embedId: `embedId_iframe_${
41
41
  Date.now().toString(36) + Math.random().toString(36).substring(2)
42
42
  }`,
43
- height: '0px',
43
+ height: window.location.href.includes('plugin-menu') ? '0px' : '100%',
44
44
  _resizeObserver: null,
45
45
  _heightCheckTimer: null,
46
46
  _weexRoot: null,
@@ -86,7 +86,6 @@ export default {
86
86
  if (args.progressText) {
87
87
  this.progressText = args.progressText;
88
88
  } else if (args.url) {
89
- this.progressText = ''
90
89
  this.url = args.url;
91
90
  this.backgroundColor = args.pageBackgroundColor;
92
91
  this.pluginType = args.pluginType
@@ -68,8 +68,6 @@
68
68
  </div>
69
69
  </transition-group>
70
70
  </div>
71
-
72
- <!-- 编辑名称弹窗 -->
73
71
  <div v-if="showEditDialog" class="modal-mask">
74
72
  <div class="modal">
75
73
  <div class="modal-title">当前视角名称</div>
@@ -175,10 +173,47 @@
175
173
  this.editInputValue = '';
176
174
  this.editIndex = null;
177
175
  },
176
+
177
+ /**
178
+ * @description 校验并过滤输入内容:仅允许中文/英文/数字。
179
+ * @param {string} value 当前输入值
180
+ * @returns {string} 校验并过滤后的值
181
+ */
182
+ validateAndFilterInput(value) {
183
+ if (!value) return '';
184
+ // 过滤:只保留中文、英文、数字
185
+ // 正则表达式:[^a-zA-Z0-9\u4e00-\u9fa5] 匹配所有非英文、非数字、非汉字的字符
186
+ let filteredValue = value.replace(/[^a-zA-Z0-9\u4e00-\u9fa5]/g, '');
187
+ return filteredValue;
188
+ },
189
+
190
+ showToast(message) {
191
+ console.log(`[TOAST 提示]: ${message}`);
192
+ if (typeof weex !== 'undefined' && weex.requireModule('bridgeModule')) {
193
+ weex.requireModule('bridgeModule').toast({
194
+ message: message,
195
+ bottom: 1,
196
+ duration: 1.5 // 1.5s
197
+ });
198
+ }
199
+ },
200
+
178
201
  onEditConfirm() {
202
+ const originalValue = (this.editInputValue || '').trim();
203
+ const newLabel = this.validateAndFilterInput(originalValue);
204
+
205
+ // 2. 检查是否为空
206
+ if (!newLabel) {
207
+ this.showToast('不支持为空');
208
+ return;
209
+ }
210
+ // 3. 检查长度
211
+ if (newLabel.length > 8) {
212
+ // 长度超限:提示并阻止后续更新和关闭逻辑
213
+ this.showToast('限8个字符以内名称,请重新输入');
214
+ return;
215
+ }
179
216
  if (this.editIndex !== null && this.data.list && this.data.list[this.editIndex]) {
180
- const newLabel = (this.editInputValue || '').trim();
181
- // 更新 label
182
217
  this.$set(this.data.list[this.editIndex], 'label', newLabel);
183
218
  // 通知外部(可选)
184
219
  this.$emit('onLabelEdited', { index: this.editIndex, label: newLabel, item: this.data.list[this.editIndex] });
@@ -188,12 +223,18 @@
188
223
  this.editIndex = null;
189
224
  },
190
225
 
191
- onDelete(item, index) {
192
- this.$emit('onDeleteEvent', { item, index });
193
- // 默认本地也删除
194
- this.data.list.splice(index, 1);
195
- this.$nextTick(this.measureItemSize);
196
- },
226
+ /**
227
+ * @description 删除列表项
228
+ * FIX: 修复了参数顺序错误,确保传入的第一个参数是 index
229
+ * @param {number} index 列表项的索引
230
+ * @param {object} item 列表项数据
231
+ */
232
+ onDelete(index, item) {
233
+ this.$emit('onDeleteEvent', { item, index });
234
+ // 默认本地也删除
235
+ this.data.list.splice(index, 1);
236
+ this.$nextTick(this.measureItemSize);
237
+ },
197
238
 
198
239
  onTouchStart(e, index) {
199
240
  if (!e.changedTouches || e.changedTouches.length === 0) return;
@@ -538,7 +579,4 @@
538
579
  height: 32px;
539
580
  background: #eee;
540
581
  }
541
- </style>
542
-
543
-
544
-
582
+ </style>
@@ -201,11 +201,11 @@ export default {
201
201
  },
202
202
 
203
203
  onStart(res) {
204
- this.$emit('onStart', res);
204
+ this.$emit('start', res);
205
205
  },
206
206
 
207
207
  onPause(res) {
208
- this.$emit('onPause', res);
208
+ this.$emit('Pause', res);
209
209
  },
210
210
 
211
211
  finish(res) {
@@ -213,11 +213,11 @@ export default {
213
213
  },
214
214
 
215
215
  onFail(res) {
216
- this.$emit('onFail', res);
216
+ this.$emit('fail', res);
217
217
  },
218
218
 
219
219
  onReadyToPlay(res) {
220
- this.$emit('onReadyToPlay', res);
220
+ this.$emit('readyToPlay', res);
221
221
  },
222
222
 
223
223
  deleteVideo(res) {