Get value from Multiselect

How can I get multiselect value in classes? Multiselect name is align

classes() {
return “merhaba” + this.content.align;

},

   type: group
    fields:
      align:
        label : Align
        type  : multiselect
        translate: false
        layout: list
        max   : 5
        options:

  uk-text-left@xl:     Left for Screen and higher
  uk-text-center@xl:   Center for Screen and higher
  uk-text-right@xl:    Right for Screen and higher

  uk-text-left@l:     Left for Desktop and higher
  uk-text-center@l:   Center for Desktop and higher
  uk-text-right@l:    Right for Desktop and higher

  uk-text-left@m:     Left for Tablet and higher
  uk-text-center@m:   Center for Tablet and higher
  uk-text-right@m:    Right for Tablet and higher

  uk-text-left@s:     Left for Phone and higher
  uk-text-center@s:   Center for Phone and higher
  uk-text-right@s:    Right for Phone and higher

  uk-text-left:     Left
  uk-text-center:   Center
  uk-text-right:    Right

What do you want to get here? A single value? Replace the commas? Get an array? I’m missing some context…

Hi Texnie

Yes A single value. Also if you say array it will be good :slight_smile:

Standard JavaScript for getting an array from a comma separated list would be split()

this.content.align.split(',');
return "merhaba" + this.content.align.split(',');

I got this error: this.content.align.split is not a function

Where are you using this?

What if anything, does this.content.align return?

This is text plugin. When I select the ‘uk-text-center’ from align multiselect on panel then the text must be center align.

panel.plugin("aristotheme/block-text", {
  blocks: {
    text: {
      computed: {
        classes() {
          return this.content.padding + " " + this.content.removepadding + " " + this.content.margin + " " + this.content.size + " " + this.content.align.split();

        },
        classesWraper() {
       
          if (this.content.card === true) {
            return "k-block-type-text-card";
          }

        },
        placeholder() {
          return this.field("text", {}).placeholder;
        }
      },
      methods: {
        focus() {
          this.$refs.text.focus();
        }
      },
      template: `
        <template>
          <div :class="classesWraper">
            <k-writer
              :class="classes"
              :placeholder="placeholder"
              :value="content.text"
              ref="text"
              @input="update({ text: $event })"
            />
          </div>
        </template>
      `
    }
  }
});