i have this code in components/titlebar.vue that works:
<template>
<div data-tauri-drag-region class="titlebar">
<div class="titlebar-button" id="titlebar-minimize"></div>
<div class="titlebar-button" id="titlebar-maximize"></div>
<div class="titlebar-button" id="titlebar-close"></div>
</div>
</template>
but if i add this to it (make the controlls actually work):
<script>
import { appWindow } from "@tauri-apps/api/window";
export default {
mounted() {
window.addEventListener("tauri://loaded", () => {
document
.getElementById("titlebar-minimize")
.addEventListener("click", () => appWindow.minimize());
document
.getElementById("titlebar-maximize")
.addEventListener("click", () => appWindow.toggleMaximize());
document
.getElementById("titlebar-close")
.addEventListener("click", () => appWindow.close());
});
},
};
</script>
i get:
window is not defined
how can i fix that?