demo1.vue 572 B

123456789101112131415161718192021222324252627
  1. <template>
  2. <m-select v-model="selVal" @change="handleChange">
  3. <m-option
  4. v-for="item in options"
  5. :key="item.value"
  6. :label="item.label"
  7. :value="item.value">
  8. </m-option>
  9. </m-select>
  10. </template>
  11. <script setup>
  12. import { ref } from 'vue-demi'
  13. const selVal = ref('')
  14. const options = [
  15. { value: 'value1',label: 'Option1'},
  16. { value: 'value2',label: 'Option2'},
  17. { value: 'value3',label: 'Option3'},
  18. { value: 'value4',label: 'Option4'},
  19. { value: 'value5',label: 'Option5'}
  20. ]
  21. const handleChange = (e) => {
  22. console.log(e);
  23. }
  24. </script>