@@ -549,12 +549,19 @@ export default {
549549 }
550550 this .optionsList = [];
551551 const that = this ;
552- jsonList .forEach (item => {
553- that .optionsList .push ({
554- [that .keyField ]: item[that .keyField ],
555- [that .valueField ]: item[that .valueField ],
556- [that .ariaLabelField ]: item[that .ariaLabelField ]
557- });
552+ jsonList .forEach ((item ) => {
553+ if (that .renderAs === " checkbox" ) {
554+ that .optionsList .push ({
555+ [that .keyField ]: item[that .keyField ],
556+ [that .valueField ]: item[that .valueField ],
557+ [that .ariaLabelField ]: item[that .ariaLabelField ]
558+ });
559+ } else {
560+ that .optionsList .push ({
561+ [that .keyField ]: item[that .keyField ],
562+ [that .valueField ]: item[that .valueField ]
563+ });
564+ }
558565 });
559566 this .jsonError = ' ' ;
560567 },
@@ -582,7 +589,9 @@ export default {
582589 this .editIndex = index;
583590 this .optionContent = this .optionsList [index][this .valueField ];
584591 this .optionValue = this .optionsList [index][this .keyField ];
585- this .optionAriaLabel = this .optionsList [index][this .ariaLabelField ];
592+ if (this .renderAs === " checkbox" ) {
593+ this .optionAriaLabel = this .optionsList [index][this .ariaLabelField ];
594+ }
586595 this .optionError = ' ' ;
587596 },
588597 showAddOption () {
@@ -602,22 +611,28 @@ export default {
602611 this .optionError = ' An item with the same key already exists' ;
603612 return ;
604613 }
605- this .optionsList . push (
606- {
614+ if ( this .renderAs === " checkbox " ) {
615+ this . optionsList . push ( {
607616 [this .valueField ]: this .optionContent ,
608617 [this .keyField ]: this .optionValue ,
609- [this .ariaLabelField ]: this .optionAriaLabel ,
610- }
611- );
612- }
613- else {
618+ [this .ariaLabelField ]: this .optionAriaLabel
619+ });
620+ } else {
621+ this .optionsList .push ({
622+ [this .valueField ]: this .optionContent ,
623+ [this .keyField ]: this .optionValue
624+ });
625+ }
626+ } else {
614627 if (this .optionsList .find ((item , index ) => { return item[that .keyField ] === this .optionValue && index !== this .editIndex ; })) {
615628 this .optionError = ' An item with the same key already exists' ;
616629 return ;
617630 }
618631 this .optionsList [this .editIndex ][this .keyField ] = this .optionValue ;
619632 this .optionsList [this .editIndex ][this .valueField ] = this .optionContent ;
620- this .optionsList [this .editIndex ][this .ariaLabelField ] = this .optionAriaLabel ;
633+ if (this .renderAs === " checkbox" ) {
634+ this .optionsList [this .editIndex ][this .ariaLabelField ] = this .optionAriaLabel ;
635+ }
621636 }
622637
623638 this .jsonData = JSON .stringify (this .optionsList );
0 commit comments