From 2a1c47b8dcc579ba7b11b87693f4064dec936057 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 17 Jul 2022 10:14:23 +0100
Subject: [PATCH] feat: better vue structure

---
 examples/web/index.ts                               |  7 ++++---
 examples/web/vue/app.vue                            |  6 +++---
 examples/web/vue/components/{ => button}/button.vue |  0
 examples/web/vue/components/index.ts                | 13 +++++++++++++
 examples/web/vue/index.ts                           | 12 ++++++++++++
 5 files changed, 32 insertions(+), 6 deletions(-)
 rename examples/web/vue/components/{ => button}/button.vue (100%)
 create mode 100644 examples/web/vue/components/index.ts
 create mode 100644 examples/web/vue/index.ts

diff --git a/examples/web/index.ts b/examples/web/index.ts
index 366f76b8..9acc538c 100644
--- a/examples/web/index.ts
+++ b/examples/web/index.ts
@@ -1,8 +1,10 @@
 import { createApp } from "vue";
-import App from "./vue/app.vue";
+import Boytacean from "./vue/app.vue";
 import { default as _wasm, GameBoy, PadKey, PpuMode } from "./lib/boytacean.js";
 import info from "./package.json";
 
+console.info(Boytacean);
+
 const PIXEL_UNSET_COLOR = 0x1b1a17ff;
 
 const LOGIC_HZ = 600;
@@ -1101,8 +1103,7 @@ const wasm = async () => {
 (async () => {
     (globalThis as any).__VUE_OPTIONS_API__ = true;
     (globalThis as any).__VUE_PROD_DEVTOOLS__ = false;
-
-    createApp(App).mount("#app");
+    createApp(Boytacean).mount("#app");
 
     const emulator = new Emulator();
     await emulator.main();
diff --git a/examples/web/vue/app.vue b/examples/web/vue/app.vue
index ee279da3..5154c7de 100644
--- a/examples/web/vue/app.vue
+++ b/examples/web/vue/app.vue
@@ -1,5 +1,5 @@
 <template>
-    <div v-bind:class="'hello'" v-on:click="() => count++">Hello This {{ name }} {{ count}}!</div>
+    <div v-bind:class="'hello'" v-on:click="() => count++">Hello {{ name }} {{ count}}!</div>
 </template>
 
 <style scoped>
@@ -10,7 +10,7 @@
 </style>
 
 <script>
-export const App = {
+export const Boytacean = {
     data() {
         return {
             name: "Vue",
@@ -19,5 +19,5 @@ export const App = {
     }
 };
 
-export default App;
+export default Boytacean;
 </script>
diff --git a/examples/web/vue/components/button.vue b/examples/web/vue/components/button/button.vue
similarity index 100%
rename from examples/web/vue/components/button.vue
rename to examples/web/vue/components/button/button.vue
diff --git a/examples/web/vue/components/index.ts b/examples/web/vue/components/index.ts
new file mode 100644
index 00000000..a6aa31e1
--- /dev/null
+++ b/examples/web/vue/components/index.ts
@@ -0,0 +1,13 @@
+import { App } from "vue";
+
+import { Button } from "./button/button.vue";
+
+const install = (Vue: App) => {
+    Vue.component("vue", Button);
+};
+
+export {
+    Button
+};
+
+export default install;
diff --git a/examples/web/vue/index.ts b/examples/web/vue/index.ts
new file mode 100644
index 00000000..ab32c201
--- /dev/null
+++ b/examples/web/vue/index.ts
@@ -0,0 +1,12 @@
+import { App } from "vue";
+
+import Components from "./components";
+
+const install = (Vue: App) => {
+    Vue.use(Components);
+};
+
+export * from "./components";
+export { Boytacean } from "./app.vue";
+
+export default install;
-- 
GitLab