فهرست منبع

fix: can't dynamically input start index

Ahmad Kholid 2 سال پیش
والد
کامیت
2db7f97c9f

+ 0 - 2
src/components/newtab/workflow/edit/EditLoopData.vue

@@ -119,8 +119,6 @@
         :label="t('workflow.blocks.loop-data.startIndex')"
         placeholder="0"
         class="w-full mt-2"
-        min="0"
-        type="number"
         @change="updateData({ startIndex: +$event || 0 })"
       />
       <ui-checkbox

+ 1 - 0
src/utils/shared.js

@@ -699,6 +699,7 @@ export const tasks = {
     refDataKeys: [
       'maxLoop',
       'loopData',
+      'startIndex',
       'variableName',
       'referenceKey',
       'elementSelector',

+ 4 - 2
src/workflowEngine/blocksHandler/handlerLoopData.js

@@ -76,10 +76,12 @@ async function loopData({ data, id }, { refData }) {
           throw new Error('invalid-loop-data');
         }
 
+        const startIndex = +data.startIndex;
+
         if (data.resumeLastWorkflow && this.engine.isPopup) {
           index = JSON.parse(localStorage.getItem(`index:${id}`)) || 0;
-        } else if (data.startIndex > 0) {
-          index = data.startIndex;
+        } else if (!Number.isNaN(startIndex) && startIndex > 0) {
+          index = startIndex;
         }
 
         if (data.reverseLoop && data.loopThrough !== 'elements') {