dext5 sample 추가

This commit is contained in:
keymasroy
2022-01-16 23:09:21 +09:00
parent 2b91460a24
commit 7a12777750
13 changed files with 134 additions and 4 deletions

View File

@@ -0,0 +1 @@
import { contextHolder } from '@ustra/nuxt/src/utils/nuxt-utils'

View 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>

View File

@@ -59,6 +59,7 @@ export default class extends SampleBoComponent {
type: 'title',
value: this.title,
})
}
// #endregion
// #region watches

View 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
}

View File

@@ -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')
})
}

View File

@@ -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"]
},

View File

@@ -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
}
}

View File

@@ -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"]
},

View File

@@ -0,0 +1,8 @@
import { contextHolder } from '@ustra/nuxt/src/utils/nuxt-utils'
/**
* core plugin을 조회
*/
export const $core = () => {
return contextHolder.get().$core
}

View File

@@ -0,0 +1,9 @@
import { $core } from './plugin-utils'
/**
* 플러그인의 alert 메시지 호출
* @param message 메시지
*/
export const executeAlert = (message: string) => {
$core().alert(message)
}

View File

@@ -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"]
},

View File

@@ -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"]
},