Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select optionFormat issue #90

Closed
Kestami opened this issue Nov 23, 2021 · 4 comments
Closed

Select optionFormat issue #90

Kestami opened this issue Nov 23, 2021 · 4 comments

Comments

@Kestami
Copy link

Kestami commented Nov 23, 2021

Development Relevant Information:

BalmUI version: 9.38.2
Browser: Chrome
Operating System: Win 10

Hi,

I'm trying to change the bound optionFormat for a select dropdown.

This works (default bindings):

//component
<ui-select v-model="myModel"
                 :options="options">
Dropdown
</ui-select>

//data
data: {
   myModel: ''
   options: [
      {
         label: 'test1',
         value: 1
      },
      {
         label: 'test2',
         value: 2
      }
  ]
}

And when the incoming data has different names, it doesn't seem to work:

//component
<ui-select v-model="myModel"
                 :options="options"
                 optionFormat="{ label: 'myLabel', value: 'myValue' }">
Dropdown
</ui-select>

//data
data: {
   myModel: ''
   options: [
      {
         myLabel: 'test1',
         myValue: 1
      },
      {
         myLabel: 'test2',
         myValue: 2
      }
  ]
}

Am I doing something wrong here in the way that I'm configuring it, or could you check if this is a bug?

Cheers!

@elf-mouse
Copy link
Member

Hi @Kestami ,

It's :optionFormat not optionFormat, please check your code again~

@Kestami
Copy link
Author

Kestami commented Nov 24, 2021

Apologies! That's worked. Thanks!

Apart from just trying both optionFormat and :optionFormat, is there a way the documentation indicates when it needs a : at the start? Is it just when the type is not primitive?

Cheers.

@elf-mouse
Copy link
Member

Apologies! That's worked. Thanks!

Apart from just trying both optionFormat and :optionFormat, is there a way the documentation indicates when it needs a : at the start? Is it just when the type is not primitive?

Cheers.

This is the basic syntax of Vue. See the vue documentation for more.

@Kestami
Copy link
Author

Kestami commented Nov 25, 2021

Perfect, thanks!

@Kestami Kestami closed this as completed Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants