diff options
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/hxfetch.ts | 29 | ||||
-rwxr-xr-x | plugins/vuetify.ts | 32 |
2 files changed, 61 insertions, 0 deletions
diff --git a/plugins/hxfetch.ts b/plugins/hxfetch.ts new file mode 100755 index 0000000..c5d85f7 --- /dev/null +++ b/plugins/hxfetch.ts @@ -0,0 +1,29 @@ +// Author: Haoxiang Zhao
+
+import { defineNuxtPlugin } from "nuxt/app";
+
+let baseurl: string = "/";
+
+let hxfetch: object = {
+ get: (url: string, payload: object | any) => {
+ let payloadobject = new URLSearchParams(payload);
+ let params: string = payloadobject.toString();
+ return fetch(baseurl.concat(url).concat("?").concat(params), {
+ method: "GET",
+ });
+ },
+ post: (url: string, payload: object) => {
+ return fetch(baseurl.concat(url), {
+ method: "POST",
+ body: JSON.stringify(payload),
+ });
+ },
+};
+
+export default defineNuxtPlugin(() => {
+ return {
+ provide: {
+ hxfetch: hxfetch,
+ },
+ };
+});
diff --git a/plugins/vuetify.ts b/plugins/vuetify.ts new file mode 100755 index 0000000..7fc71d8 --- /dev/null +++ b/plugins/vuetify.ts @@ -0,0 +1,32 @@ +// Author: Haoxiang Zhao
+
+import { defineNuxtPlugin } from "nuxt/app";
+import { createVuetify } from "vuetify";
+import * as components from "vuetify/components";
+import * as directives from "vuetify/directives";
+import colors from "vuetify/lib/util/colors.mjs";
+
+export default defineNuxtPlugin((nuxtApp) => {
+ const vuetify = createVuetify({
+ components,
+ directives,
+ theme: {
+ defaultTheme: "hxlight",
+ themes: {
+ hxlight: {
+ dark: false,
+ colors: {
+ primary: colors.green.darken2,
+ },
+ },
+ hxdark: {
+ dark: true,
+ colors: {
+ primary: colors.green.darken2,
+ },
+ },
+ },
+ },
+ });
+ nuxtApp.vueApp.use(vuetify);
+});
|