From 9e4046a69dd1161701b9961256ed63bcb3562a6b Mon Sep 17 00:00:00 2001 From: Matthew Aaron Raymer Date: Mon, 19 Dec 2022 12:41:04 +0800 Subject: [PATCH] Adding class-based Vue Plugin for Vue stub --- src/main.ts | 2 ++ src/plugins/dexieVuePlugin/index.ts | 18 ++++++++++++++++++ src/views/AccountViewView.vue | 1 - 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/plugins/dexieVuePlugin/index.ts diff --git a/src/main.ts b/src/main.ts index 01814f6..3e58dde 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,3 +1,4 @@ +import { VueDexiePlugin } from "@/plugins/dexieVuePlugin"; import { createPinia } from "pinia"; import { createApp } from "vue"; import App from "./App.vue"; @@ -48,6 +49,7 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; createApp(App) .component("fa", FontAwesomeIcon) + .use(VueDexiePlugin()) .use(createPinia()) .use(router) .mount("#app"); diff --git a/src/plugins/dexieVuePlugin/index.ts b/src/plugins/dexieVuePlugin/index.ts new file mode 100644 index 0000000..2bd81de --- /dev/null +++ b/src/plugins/dexieVuePlugin/index.ts @@ -0,0 +1,18 @@ +import Vue from 'vue' +import { PluginObject } from 'vue' + +// define the plugin class +class VueDexiePlugin implements PluginObject<{}> { + // the install method is called when the plugin is installed + public static install(app: typeof Vue): void { + // define a custom property + app.$myProperty = 'Hello, World!' + + // define a custom method + app.prototype.$myMethod = (): string => { + return this.$myProperty + } + } +} + +export default new VueDexiePlugin() \ No newline at end of file diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 076352b..0d77992 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -184,7 +184,6 @@ export default class AccountViewView extends Vue { async created() { const previousIdentifiers: Array = []; const toLowercase = true; - this.mnemonic = createIdentifier(); [ this.address,