Powiadomienia
Wyczyść wszystko
BugOverflow
1
Wpisy
1
Użytkownicy
0
Reactions
921
Widoki
0
13/08/2021 4:35 pm
Rozpoczynający temat
ref() troubles
1 odpowiedź
0
13/08/2021 4:35 pm
Rozpoczynający temat
If you use ref(), then you have to use selected.value method
<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 options1 = [
{text: "One", value: 1},
{text: "Two", value: 2},
{text: "Three", value: 3},
{text: "Four", value: 4},
{text: "Five", value: 5},
{text: "Six", value: 6},
{text: "Seven", value: 7},
{text: "Eight", value: 8}
];
const selected1 = ref(1);
export default {
components: {
MDBSelect
},
computed:{
selectedText(){
return options1[selected1.value-1].text;
}
},
setup() {
return {
options1,
selected1
};
}
};
</script>
