mdb-select not working for vue


Topic: mdb-select not working for vue

Ingvaldsen asked 6 years ago

Hi
I am trying to run this example from the vue documentation:

<template>
<mdb-container>
<mdb-select @getValue="getSelectValue" :options="basicOptions" />
</mdb-container>
</template>

<script>
import { mdbSelect, mdbContainer } from 'mdbvue';

export default {
name: 'SelectPage',
components: {
mdbSelect,
mdbContainer
},
data() {
return {
basicOptions: [
{ text: 'Choose your option', value: null, disabled: true, selected: true },
{ text: 'Option nr 1', value: 'Option 1' },
{ text: 'Option nr 2', value: 'Option 2' },
{ text: 'Option nr 3', value: 'Option 3' }
]
};
},
methods: {
getSelectValue(value, text) {
console.log(value);
}
}
};
</script>

But I am getting the following error:
vue.esm.js?efeb:610 [Vue warn]: Error in created hook: "TypeError: Cannot read property 'forEach' of undefined"

found in

---> <Select> at node_modules\mdbvue\src\components\pro\Select.vue
<MdbContainer> at node_modules\mdbvue\src\components\Container.vue
<Demo> at src\components\Demo.vue
<App> at src\App.vue
<Root>

TypeError: Cannot read property 'forEach' of undefined
at VueComponent.created (Select.vue?58b7:140)

What is going on here?


Jakub Strebeyko staff commented 6 years ago

Hi there @Ingvaldsen,

That's weird, wasn't able to get the error by simply copying&pasting the snippet into a simple project.

Questions: What kind of build are you using with which mdbvue version?

Suggestions: mdbvue 4.10.1 has been just released -- no changes regarding select there, but perhaps a small refreshing through update would help?

Once some details are here, I will be following your install steps to see what's up

Best,
Kuba 


Ingvaldsen commented 6 years ago

I don't know exactly why, but it works for me now. Thanks for answer ;)


Jakub Strebeyko staff commented 6 years ago

Happy to hear that. :)

Best,
Kuba


Mikołaj Smoleński staff commented 6 years ago

Nice to read about it. We wish you successful projects with MDB Vue.

Best regards!


hheverson pro commented 6 years ago

Hello, I'm having the exact same issue. @Ingvaldsen you solved by just updating?


hheverson pro commented 6 years ago

Can somebody tell me how to update my mdbvue?


Jakub Strebeyko staff commented 6 years ago

Hi @hheverson,

Depending on the way you did download the package the first time, be it either from Orders panel here on mdbootstrap.com or our official GitLab, doing it again should bring about the freshest possible installment of MDBVue.

Best, Kuba


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 4.8.2
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: Yes
  • Provided link: No