Fixed reactivity in Inventory component

This commit is contained in:
Dennis Postma 2024-08-24 03:14:19 +02:00
parent b5e2474c6d
commit d8863fe51f
3 changed files with 7 additions and 7 deletions

View File

@ -10,7 +10,7 @@
<button @mousedown.stop class="btn-cyan py-1.5 px-4 min-w-24">Settings</button>
</div>
<div class="flex gap-2.5">
<button class="w-5 h-5 m-0 p-0 relative hover:rotate-180 transition-transform duration-300 ease-in-out">
<button class="w-5 h-5 m-0 p-0 relative hover:rotate-180 transition-transform duration-300 ease-in-out" @click="gameStore.toggleInventory">
<img alt="close" draggable="false" src="/assets/icons/close-button-white.svg" class="w-full h-full" />
</button>
</div>
@ -27,19 +27,19 @@
</template>
<script setup lang="ts">
import { useGameStore } from '@/stores/game';
import { ref } from 'vue';
import { useGameStore } from '@/stores/game';
import InventoryItems from '@/components/gui/partials/InventoryItems.vue';
const gameStore = useGameStore()
let inventory = false
let inventory = ref(true)
let equipment = false
let character = false
let settings = false
function inventoryActive() {
inventory = !inventory;
console.log(inventory);
inventory.value = !inventory.value;
console.log(inventory.value);
}
</script>

View File

@ -8,7 +8,7 @@
<div class="absolute -left-5 -bottom-5 w-[calc(100%_+_40px)] my-px h-px bg-cyan-200"></div>
</div>
<div class="m-5">
<h4 class="m-auto font-medium text-lg max-w-[375px]">Quest items</h4>
<h4 class="m-auto font-medium text-lg max-w-[375px]">Chest items</h4>
<div class="flex gap-3 mt-4 mx-auto flex-wrap max-w-[375px]">
<div v-for="n in 12" class="bg-gray-300/80 border-solid border-2 border-cyan-200 w-12 h-12 rounded-md aspect-square shrink-0 justify-self-stretch hover:bg-gray-200"></div>
</div>

View File

@ -1,7 +1,7 @@
<template>
<Tiles :key="zoneStore.zone?.id ?? 0" />
<Objects />
<Characters />
<!-- <Characters />-->
</template>
<script setup lang="ts">