refactor: set Option

This commit is contained in:
Thanaphon Frappet 2024-10-17 15:20:54 +07:00
parent f80e132df5
commit ea172bfc36

View file

@ -1,16 +1,37 @@
<script lang="ts" setup>
import { onMounted, nextTick, ref, watch } from 'vue';
// NOTE: Import stores
import useOptionStore from 'stores/options';
// NOTE Import Types
import { BankBook } from 'stores/branch/types';
// NOTE: Import Components
import ViewHeader from './ViewHeader.vue';
import BankComponents from './BankComponents.vue';
const optionStore = useOptionStore();
let count = 50;
const elements = ref<HTMLElement[]>([]);
const chunks = ref<number[][]>([[]]);
const bankList = ref<BankBook[]>([
{
id: 'cm14grwo30003z8chvzouoc87',
currentlyUse: true,
branchId: 'cm14grwo30002z8ch55keto89',
bankUrl:
'http://192.168.1.61:20102/api/v1/branch/cm14grwo30002z8ch55keto89/bank-qr/cm14grwo30003z8chvzouoc87?ts=1729148488206',
bankName: 'ktb',
bankBranch: 'โรงพยาบาลศิริราชปิยมหาราชการุณย์',
accountType: '',
accountNumber: '1-520-361442-23',
accountName: 'บริษัท สยามเทคโนโลยี จำกัด',
},
]);
async function assignData() {
for (let i = 0; i < count; i++) {
let el = elements.value.at(-1);
@ -48,7 +69,8 @@ function getHeight(el: HTMLElement) {
return height;
}
onMounted(() => {
onMounted(async () => {
await optionStore.fetchOption();
assignData();
});