xxxxxxxxxx
1
<template>
2
<MDBSelect v-model:options="options1" v-model:selected="selected1" ref="selectRef"/>
3
</template>
xxxxxxxxxx
1
<style>
2
#app {
3
font-family: Roboto, Helvetica, Arial, sans-serif;
4
}
5
</style>
xxxxxxxxxx
1
<script>
2
import { MDBSelect } from "mdb-vue-ui-kit";
3
import { ref, onMounted } from "vue";
4
5
export default {
6
components: {
7
MDBSelect
8
},
9
setup() {
10
const options1 = ref([
11
{ text: "One", value: 1 },
12
{ text: "Two", value: 2 },
13
{ text: "Three", value: 3 },
14
{ text: "Four", value: 4 },
15
{ text: "Five", value: 5 },
16
{ text: "Six", value: 6 },
17
{ text: "Seven", value: 7 },
18
{ text: "Eight", value: 8 }
19
]);
20
const selected1 = ref("");
21
22
const selectRef = ref(null);
23
24
onMounted(()=>{
25
selectRef.value.setValue(4);
26
})
27
28
return {
29
options1,
30
selected1,
31
selectRef
32
};
33
}
34
};
35
</script>
Console errors: 0