File tree Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Expand file tree Collapse file tree 1 file changed +22
-9
lines changed Original file line number Diff line number Diff line change 20
20
<template slot="label">
21
21
<span class =" has-text-white" >Code</span >
22
22
</template >
23
- <codemirror v-model =" codeL" class =" codemirror" :options =" cmOption" />
23
+ <codemirror
24
+ v-model =" codeL"
25
+ class =" codemirror"
26
+ :options =" cmOption"
27
+ />
24
28
</b-field >
25
29
<b-field >
26
30
<template slot="label">
27
31
<span class =" has-text-white" >Output</span >
28
32
</template >
29
33
<textarea class =" textarea" v-model =" outputL" readonly rows =" 4" />
30
34
</b-field >
31
- <b-button type =" button is-primary" @click =" updateList" >Save</b-button >
35
+ <b-button type =" button is-primary" @click =" updateList"
36
+ >Save</b-button
37
+ >
32
38
<b-button type =" button" @click =" runCode()" outlined >Run</b-button >
33
39
</div >
34
40
</div >
@@ -185,21 +191,28 @@ export default {
185
191
// bad way to see if multiple lines - fix if possible
186
192
else if (this .inputL .includes (" \n " )) {
187
193
var newArr = " [" ;
188
-
189
- this .inputL .split (" \n " ).forEach (function (element ) {
190
- var inp = this .typeString (element);
191
-
194
+ var splitArr = this .inputL .split (" \n " );
195
+ for (let i = 0 ; i < splitArr .length ; i++ ) {
196
+ var inp = this .typeString (splitArr[i]);
192
197
if (inp == null ) {
193
198
return null ;
194
199
} else if (
195
200
// check if string
196
201
this .isString (inp)
197
202
) {
198
- newArr = newArr + " '" + inp + " '," ;
203
+ if (i == splitArr .length - 1 ) {
204
+ newArr = newArr + " '" + inp + " '" ;
205
+ } else {
206
+ newArr = newArr + " '" + inp + " '," ;
207
+ }
199
208
} else {
200
- newArr = newArr + inp + " ," ;
209
+ if (i == splitArr .length - 1 ) {
210
+ newArr = newArr + inp;
211
+ } else {
212
+ newArr = newArr + inp + " ," ;
213
+ }
201
214
}
202
- });
215
+ }
203
216
newArr = newArr + " ]" ;
204
217
return newArr;
205
218
} else {
You can’t perform that action at this time.
0 commit comments