fix: select
This commit is contained in:
parent
cbd2706aa1
commit
615cbcf0c4
1 changed files with 31 additions and 6 deletions
|
|
@ -1,10 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
const { locale } = useI18n({ useScope: 'global' });
|
||||||
|
|
||||||
const remark = defineModel<string>('remark', { default: '' });
|
const remark = defineModel<string>('remark', { default: '' });
|
||||||
const detail = defineModel<string>('detail');
|
const detail = defineModel<string>('detail');
|
||||||
const process = defineModel<number>('process');
|
const process = defineModel<number>('process');
|
||||||
const name = defineModel<string>('name');
|
const name = defineModel<string>('name');
|
||||||
const code = defineModel<string>('code');
|
const code = defineModel<string>('code');
|
||||||
|
|
||||||
|
const codeOption = ref([]);
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
dense?: boolean;
|
dense?: boolean;
|
||||||
outlined?: boolean;
|
outlined?: boolean;
|
||||||
|
|
@ -12,6 +18,18 @@ defineProps<{
|
||||||
separator?: boolean;
|
separator?: boolean;
|
||||||
isType?: boolean;
|
isType?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const resultOption = await fetch('/option/option.json');
|
||||||
|
const option = await resultOption.json();
|
||||||
|
|
||||||
|
if (locale.value === 'en-US') {
|
||||||
|
codeOption.value = option.eng.typeProduct;
|
||||||
|
}
|
||||||
|
if (locale.value === 'th-th') {
|
||||||
|
codeOption.value = option.tha.typeProduct;
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -20,17 +38,24 @@ defineProps<{
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-9 row q-col-gutter-md">
|
<div class="col-9 row q-col-gutter-md">
|
||||||
<q-input
|
<q-select
|
||||||
for="input-code"
|
id="select-br-id"
|
||||||
:outlined="!readonly"
|
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
|
outlined
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:borderless="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
options-dense
|
||||||
|
clearable
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="col-3"
|
class="col-3"
|
||||||
:label="$t('productCode')"
|
|
||||||
v-model="code"
|
v-model="code"
|
||||||
:rules="[(val: string) => (!!val && val === 'AC') || val === 'DO']"
|
:label="$t('productCode')"
|
||||||
|
option-label="label"
|
||||||
|
option-value="value"
|
||||||
|
:options="codeOption"
|
||||||
|
:rules="[(val: string) => !!val]"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue