WIP: account info modal prototype with a little bit of pinia state mgmt.

This commit is contained in:
Cindy Chang
2024-06-20 12:13:39 +08:00
parent d6a79687da
commit 26441d3979
9 changed files with 183 additions and 47 deletions

View File

@@ -3,23 +3,43 @@
flex justify-center items-center">
<div class="flex">
<ModalAccountEdit/>
<ModalAccountEdit v-if="whichModal === MODAL_ACCT_EDIT"/>
<ModalAccountInfo v-if="whichModal === MODAL_ACCT_INFO"/>
</div>
</div>
</template>
<script>
import { watch, computed, } from 'vue';
import { useModalStore } from '@/stores/modal.js';
import ModalAccountEdit from './ModalAccountEdit.vue';
import ModalAccountInfo from './ModalAccountInfo.vue';
import {
MODAL_CREATE_NEW,
MODAL_ACCT_EDIT,
MODAL_ACCT_INFO,
} from "@/constants/constants.js";
export default {
setup() {
const modalStore = useModalStore();
const whichModal = computed(() => modalStore.whichModal);
watch(() => whichModal, (newVal, oldVal) => {
// (`whichModal changed from ${oldVal} to ${newVal}`);
});
return {
modalStore,
whichModal,
MODAL_CREATE_NEW,
MODAL_ACCT_EDIT,
MODAL_ACCT_INFO,
};
},
components: {
ModalAccountEdit,
ModalAccountInfo,
}
};
</script>