Forum

MDB VUE Select - ho...
 
Notifications
Clear all

MDB VUE Select - how to pass data to component

1 Posty
1 Users
0 Reactions
817 Widok
0
Topic starter

example

1 Answer
0
Topic starter

Caller

<simple-select :options1="[{text: 'One', value: 1}, {text: 'Two', value: 2},]"></simple-select>

Component

<template>
    <MDBSelect v-model:options="options1" v-model:selected="selected1" filter/>
    <span>selected: {{ selectedText }}</span>
</template>


<script>
import {MDBSelect} from "mdb-vue-ui-kit";
import {ref} from "vue";

const selected1 = ref(1);

export default {
    components: {
        MDBSelect
    },
    props: {
        options1: Object
    },
    computed:{
      selectedText(){
          return this.options1[selected1.value-1].text;
      }
    },
    setup() {
        return {
            selected1
        };
    }
};
</script>

 

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: