dext5 sample 추가
This commit is contained in:
1
front/bo/client/modules/plugin-utils.ts
Normal file
1
front/bo/client/modules/plugin-utils.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import { contextHolder } from '@ustra/nuxt/src/utils/nuxt-utils'
|
||||||
49
front/bo/client/pages/samples/dext5-editor.vue
Normal file
49
front/bo/client/pages/samples/dext5-editor.vue
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<dx-button text="html 입력" @click="editValue = '<p>text value</p>'"></dx-button>
|
||||||
|
<dx-button text="입력 값 확인" @click="checkEditor"></dx-button>
|
||||||
|
<dx-button text="text 조회" @click="getText"></dx-button>
|
||||||
|
<dx-button text="초기화" @click="editValue = ''"></dx-button>
|
||||||
|
<dext5-editor ref="editor" v-model="editValue" :config="{ Width: '90%' }" />
|
||||||
|
|
||||||
|
<div>입력 html : {{ editValue }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Ref } from 'vue-property-decorator'
|
||||||
|
import { UstraBoComponent } from '@ustra/nuxt-mng-bo/src/components/ustra-bo-component'
|
||||||
|
import Dext5Editor from '@ustra/nuxt/src/vue/components/dext5/dext5-editor.vue'
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: { Dext5Editor },
|
||||||
|
})
|
||||||
|
export default class extends UstraBoComponent {
|
||||||
|
// #region variables
|
||||||
|
editValue: string = ''
|
||||||
|
|
||||||
|
@Ref() readonly editor: Dext5Editor
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
// #region hooks
|
||||||
|
created() {
|
||||||
|
this.editValue = `<p>init value</p>`
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
// #region methods
|
||||||
|
checkEditor() {
|
||||||
|
if (this.editor.isEmpty()) {
|
||||||
|
alert('입력 값이 없습니다.')
|
||||||
|
} else {
|
||||||
|
alert('입력 값이 있습니다.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getText() {
|
||||||
|
alert(this.editor.getTextValue())
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
// #region watches
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss"></style>
|
||||||
@@ -59,6 +59,7 @@ export default class extends SampleBoComponent {
|
|||||||
type: 'title',
|
type: 'title',
|
||||||
value: this.title,
|
value: this.title,
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
// #region watches
|
// #region watches
|
||||||
|
|||||||
33
front/bo/client/plugins/sample-bo-plugin.ts
Normal file
33
front/bo/client/plugins/sample-bo-plugin.ts
Normal file
@@ -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
|
||||||
|
}
|
||||||
@@ -63,5 +63,7 @@ export default async () => {
|
|||||||
_config.env.SERVER_PROP_ENC_KEY = 'Z3NjLWNyeXB0by1rZXkxMQ=='
|
_config.env.SERVER_PROP_ENC_KEY = 'Z3NjLWNyeXB0by1rZXkxMQ=='
|
||||||
_config.build.transpile.push('@ustra-sample/cmm')
|
_config.build.transpile.push('@ustra-sample/cmm')
|
||||||
_config.build.extractCSS = false
|
_config.build.extractCSS = false
|
||||||
|
|
||||||
|
_config.plugins.push('~/plugins/sample-bo-plugin.ts')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["./client/*"],
|
"~/*": ["./client/*"],
|
||||||
"@/*": ["./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"]
|
"types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/nuxt-dx", "@ustra/nuxt-mng-bo", "@ustra-sample/cmm", "./types"]
|
||||||
},
|
},
|
||||||
|
|||||||
27
front/bo/types/index.d.ts
vendored
27
front/bo/types/index.d.ts
vendored
@@ -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<S> {
|
||||||
|
$bo: SampleBoPlugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vue 객체
|
||||||
|
declare module 'vue/types/vue' {
|
||||||
|
interface Vue {
|
||||||
|
$bo: SampleBoPlugin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@ustra-sample/*": ["../node_modules/@ustra-sample/*"]
|
"@ustra-sample/*": ["../*"]
|
||||||
},
|
},
|
||||||
"types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/buefy", "@ustra-sample/cmm", "./types"]
|
"types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/buefy", "@ustra-sample/cmm", "./types"]
|
||||||
},
|
},
|
||||||
|
|||||||
8
front/fo/client/modules/plugin-utils.ts
Normal file
8
front/fo/client/modules/plugin-utils.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { contextHolder } from '@ustra/nuxt/src/utils/nuxt-utils'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* core plugin을 조회
|
||||||
|
*/
|
||||||
|
export const $core = () => {
|
||||||
|
return contextHolder.get().$core
|
||||||
|
}
|
||||||
9
front/fo/client/modules/service-module.ts
Normal file
9
front/fo/client/modules/service-module.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { $core } from './plugin-utils'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 플러그인의 alert 메시지 호출
|
||||||
|
* @param message 메시지
|
||||||
|
*/
|
||||||
|
export const executeAlert = (message: string) => {
|
||||||
|
$core().alert(message)
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["./client/*"],
|
"~/*": ["./client/*"],
|
||||||
"@/*": ["./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"]
|
"types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/buefy", "buefy", "@ustra-sample/cmm", "./types"]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["./fo/client/*", "./bo/client/*"],
|
"~/*": ["./fo/client/*", "./bo/client/*"],
|
||||||
"@/*": ["./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"]
|
"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"]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user