diff --git a/front/bo/client/modules/plugin-utils.ts b/front/bo/client/modules/plugin-utils.ts new file mode 100644 index 0000000..9b43a43 --- /dev/null +++ b/front/bo/client/modules/plugin-utils.ts @@ -0,0 +1 @@ +import { contextHolder } from '@ustra/nuxt/src/utils/nuxt-utils' diff --git a/front/bo/client/pages/samples/dext5-editor.vue b/front/bo/client/pages/samples/dext5-editor.vue new file mode 100644 index 0000000..bd4a77a --- /dev/null +++ b/front/bo/client/pages/samples/dext5-editor.vue @@ -0,0 +1,49 @@ + + + diff --git a/front/bo/client/pages/samples/index.vue b/front/bo/client/pages/samples/index.vue index cfa6923..c344f8b 100644 --- a/front/bo/client/pages/samples/index.vue +++ b/front/bo/client/pages/samples/index.vue @@ -59,6 +59,7 @@ export default class extends SampleBoComponent { type: 'title', value: this.title, }) + } // #endregion // #region watches diff --git a/front/bo/client/plugins/sample-bo-plugin.ts b/front/bo/client/plugins/sample-bo-plugin.ts new file mode 100644 index 0000000..e63b054 --- /dev/null +++ b/front/bo/client/plugins/sample-bo-plugin.ts @@ -0,0 +1,33 @@ +import { Context, Plugin } from '@nuxt/types' +import Vuex from 'vuex' + +export class SampleBoPlugin { + private context: Context = null + + constructor(context: Context) { + this.context = context + } + + /** + * alert 메시지를 호출한다. + * @param message 메시지 + */ + alert(message: string) { + window.alert(message) + } +} + +export default (context: Context, inject) => { + const plugin = new SampleBoPlugin(context) + + // context 객체에 플러그인 주입 + // @ts-ignore + contenxt.$bo = plugin + + // Vue 객체에 플러그인 주입 + inject('bo', plugin) + + // Store 객체에 플러그인 주입 + // @ts-ignore + Vuex.Store.prototype.$bo = plugin +} diff --git a/front/bo/nuxt.config.ts b/front/bo/nuxt.config.ts index d58c5fb..ca94e12 100644 --- a/front/bo/nuxt.config.ts +++ b/front/bo/nuxt.config.ts @@ -63,5 +63,7 @@ export default async () => { _config.env.SERVER_PROP_ENC_KEY = 'Z3NjLWNyeXB0by1rZXkxMQ==' _config.build.transpile.push('@ustra-sample/cmm') _config.build.extractCSS = false + + _config.plugins.push('~/plugins/sample-bo-plugin.ts') }) } diff --git a/front/bo/tsconfig.json b/front/bo/tsconfig.json index b45453e..38526a5 100644 --- a/front/bo/tsconfig.json +++ b/front/bo/tsconfig.json @@ -26,7 +26,7 @@ "paths": { "~/*": ["./client/*"], "@/*": ["./client/*"], - "@ustra-sample/*": ["../node_modules/@ustra-sample/*"] + "@ustra-sample/*": ["../*"] }, "types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/nuxt-dx", "@ustra/nuxt-mng-bo", "@ustra-sample/cmm", "./types"] }, diff --git a/front/bo/types/index.d.ts b/front/bo/types/index.d.ts index e69de29..ce1115f 100644 --- a/front/bo/types/index.d.ts +++ b/front/bo/types/index.d.ts @@ -0,0 +1,27 @@ +import { SampleBoPlugin } from '../client/plugins/sample-bo-plugin' + +declare module '@nuxt/types' { + // context 객체 + interface Context { + $bo: SampleBoPlugin + } + + // app 객체 + interface NuxtAppOptions { + $bo: SampleBoPlugin + } +} + +// store 객체 +declare module 'vuex/types/index' { + interface Store { + $bo: SampleBoPlugin + } +} + +// vue 객체 +declare module 'vue/types/vue' { + interface Vue { + $bo: SampleBoPlugin + } +} diff --git a/front/cmm/tsconfig.json b/front/cmm/tsconfig.json index f0e4e2b..c907911 100644 --- a/front/cmm/tsconfig.json +++ b/front/cmm/tsconfig.json @@ -24,7 +24,7 @@ "downlevelIteration": true, "baseUrl": ".", "paths": { - "@ustra-sample/*": ["../node_modules/@ustra-sample/*"] + "@ustra-sample/*": ["../*"] }, "types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/buefy", "@ustra-sample/cmm", "./types"] }, diff --git a/front/fo/client/modules/plugin-utils.ts b/front/fo/client/modules/plugin-utils.ts new file mode 100644 index 0000000..43487ae --- /dev/null +++ b/front/fo/client/modules/plugin-utils.ts @@ -0,0 +1,8 @@ +import { contextHolder } from '@ustra/nuxt/src/utils/nuxt-utils' + +/** + * core plugin을 조회 + */ +export const $core = () => { + return contextHolder.get().$core +} diff --git a/front/fo/client/modules/service-module.ts b/front/fo/client/modules/service-module.ts new file mode 100644 index 0000000..c47200e --- /dev/null +++ b/front/fo/client/modules/service-module.ts @@ -0,0 +1,9 @@ +import { $core } from './plugin-utils' + +/** + * 플러그인의 alert 메시지 호출 + * @param message 메시지 + */ +export const executeAlert = (message: string) => { + $core().alert(message) +} diff --git a/front/fo/client/plugins/dummy.txt b/front/fo/client/plugins/dummy.txt deleted file mode 100644 index e69de29..0000000 diff --git a/front/fo/tsconfig.json b/front/fo/tsconfig.json index 3309166..aedd9fa 100644 --- a/front/fo/tsconfig.json +++ b/front/fo/tsconfig.json @@ -26,7 +26,7 @@ "paths": { "~/*": ["./client/*"], "@/*": ["./client/*"], - "@ustra-sample/*": ["../node_modules/@ustra-sample/*"] + "@ustra-sample/*": ["../*"] }, "types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/buefy", "buefy", "@ustra-sample/cmm", "./types"] }, diff --git a/front/tsconfig.json b/front/tsconfig.json index 16dd90e..731538d 100644 --- a/front/tsconfig.json +++ b/front/tsconfig.json @@ -27,7 +27,7 @@ "paths": { "~/*": ["./fo/client/*", "./bo/client/*"], "@/*": ["./fo/client/*", "./bo/client/*"], - "@ustra-sample/*": ["./node_modules/@ustra-sample/*"] + "@ustra-sample/*": ["./*"] }, "types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/nuxt-dx", "@ustra/nuxt-mng-bo", "@ustra-sample/cmm", "@ustra/buefy", "buefy", "@ustra-sample/bo", "@ustra-sample/fo"] },