xxxxxxxxxx
1
<template>
2
<div style="margin:40px">
3
4
5
<MDBSelect
6
v-model:options="options"
7
@change="change"
8
label="Testselect"
9
:multiple="true"
10
:selectAll="false"
11
:filter="true"
12
/>
13
</div>
14
</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
4
export default {
5
name: "TestSelect",
6
components: { MDBSelect },
7
data() {
8
return {
9
options: [
10
{value: 1, text: 'About'},
11
{value: 2, text: 'Busy'},
12
{value: 3, text: 'China'},
13
{value: 4, text: 'Discount'},
14
{value: 5, text: 'Eggs'},
15
]
16
}
17
},
18
methods: {
19
change() {
20
this.options.sort(function compareFn(a, b) {
21
// Selected at the beginning
22
if (a.selected !== b.selected) {
23
return (a.selected) ? -1 : 1;
24
}
25
// disabled at the end
26
if (a.disabled !== b.disabled) {
27
return (a.disabled) ? 1 : -1;
28
}
29
// default alphabetical
30
if (a.disabled === b.disabled) {
31
return a.text.localeCompare(b.text);
32
}
33
})
34
},
35
},
36
}
37
</script>
Console errors: 0