Browse Source

fix: can't set variable in JS block

Ahmad Kholid 2 years ago
parent
commit
b31487c556
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/sandbox/utils/handleJavascriptBlock.js

+ 3 - 0
src/sandbox/utils/handleJavascriptBlock.js

@@ -44,6 +44,9 @@ export default function (data) {
         return window.$getNestedProperties(${propertyName}.refData, keyword + '.' + path);
       }
       function automaSetVariable(name, value) {
+        const variables = ${propertyName}.refData.variables;
+        if (!variables) ${propertyName}.refData.variables = {}
+
         ${propertyName}.refData.variables[name] = value;
       }
       function automaNextBlock(data = {}, insert = true) {