CompositionComponent.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div>
  3. <q-card
  4. flat
  5. bordered
  6. >
  7. <q-tooltip v-if="tooltipText">
  8. {{tooltip_text}}
  9. </q-tooltip>
  10. <q-card-section
  11. horizontal
  12. class="items-center bg-grey-2">
  13. <div class="side_note text-grey-9 q-px-xs"
  14. style="width: 4rem"
  15. >
  16. {{title}}
  17. </div>
  18. <q-select
  19. :model-value="name"
  20. @input-value="$emit('update:name', $event)"
  21. use-input
  22. hide-selected
  23. fill-input
  24. input-debounce="0"
  25. :options="options"
  26. style="width: 10rem"
  27. options-dense
  28. dense
  29. bg-color="white"
  30. class="q-py-none"
  31. >
  32. <template v-slot:no-option>
  33. <q-item>
  34. <q-item-section class="text-grey">
  35. No results
  36. </q-item-section>
  37. </q-item>
  38. </template>
  39. </q-select>
  40. <div
  41. class="side_note text-grey-9 q-px-xs"
  42. style="width: 3rem"
  43. >
  44. {{ units}}
  45. </div>
  46. </q-card-section>
  47. </q-card>
  48. local options: {{name}}
  49. </div>
  50. </template>
  51. <script lang="ts">
  52. // import { useModelWrapper } from 'components/modelWrapper'
  53. import {
  54. defineComponent,
  55. // watch,
  56. // PropType,
  57. // computed,
  58. ref,
  59. // toRef,
  60. // Ref,
  61. } from 'vue';
  62. // import { Todo, Meta } from './models';
  63. // function useModelWrapper(props, emit, name = 'modelValue') {
  64. // return computed({
  65. // get: () => props[name],
  66. // set: (value) => emit(`update:${name}`, value)
  67. // })
  68. // }
  69. const stringOptions = [
  70. 'Google', 'Facebook', 'Twitter', 'Apple', 'Oracle'
  71. ]
  72. export default defineComponent({
  73. name: 'InputWithUnits',
  74. props: {
  75. name: {
  76. type: String,
  77. default: ''
  78. },
  79. title: {
  80. type: String,
  81. required: true,
  82. default: ''
  83. },
  84. units: {
  85. type:String,
  86. default: ''
  87. },
  88. tooltipText: {
  89. type: String,
  90. default: ''
  91. }
  92. },
  93. emits : [
  94. 'update:name'
  95. ],
  96. setup(props, {emit}) {
  97. // // import { ref } from 'vue'
  98. // // const return_value = ref(0)
  99. // // var options = ref([3, 2])
  100. const options = ref(stringOptions)
  101. // // var return_value = ref(null)
  102. // var model = ref(null)
  103. return {
  104. // model,
  105. options
  106. }
  107. },
  108. });
  109. </script>