From f298283facf2d5137093193287d614072e025051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chyeonggkim=E2=80=9D?= <“hyeonggkim@smilegate.com”> Date: Wed, 21 Jan 2026 18:48:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=20CtLayout01=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layers/templates/CtLayout01/index.vue | 36 +++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/layers/templates/CtLayout01/index.vue b/layers/templates/CtLayout01/index.vue index cef4121..f01867b 100644 --- a/layers/templates/CtLayout01/index.vue +++ b/layers/templates/CtLayout01/index.vue @@ -11,6 +11,9 @@ const { tm, locale } = useI18n() const customContainerRef = ref(null) const nuxtApp = useNuxtApp() + // Configuration + const runtimeConfig = useRuntimeConfig() + const staticUrl = runtimeConfig.public.staticUrl const coerceToString = (value: unknown): string => { if (typeof value === 'string') return value @@ -132,14 +135,37 @@ // custom_contents가 URL인지 확인하고 HTML 가져오기 watch( - () => props.components.custom_contents, - async (customContents) => { - if (!customContents) { + () => { + // 타입 가드: 단일 컴포넌트 패턴인지 확인 + if ('group_sets' in props.components) { + return null + } + const customContents = props.components.customContents + const firstGroup = customContents?.groups?.[0] + if (!firstGroup) { + return null + } + // res_path는 PageDataResourceGroup의 직접 속성 + // 또는 btn_info.detail.res_path 형태일 수 있음 + const resPath = (firstGroup as any).detail?.res_path + if (!resPath) { + return null + } + + // 문자열로 변환 + const resPathStr = String(resPath) + // 마지막에 "/contents" 또는 "contents"가 있으면 제거 + const cleanedResPath = resPathStr.replace(/\/?contents\/?$/, '') + return cleanedResPath + }, + async (cleanedResPath) => { + if (!cleanedResPath) { fetchedHtml.value = '' return } - const contentStr = typeof customContents === 'string' ? customContents : String(customContents) + const contentStr = typeof cleanedResPath === 'string' ? `${staticUrl}${cleanedResPath}/index.html` : String(`${staticUrl}${cleanedResPath}/index.html`) + console.log("🚀 ~ contentStr:", contentStr) let html = '' if (isUrl(contentStr)) { @@ -533,4 +559,4 @@ min-height: 20rem; background-color: #fff; } - \ No newline at end of file +