feat: CtLayout01 업로드
This commit is contained in:
@@ -11,6 +11,9 @@
|
|||||||
const { tm, locale } = useI18n()
|
const { tm, locale } = useI18n()
|
||||||
const customContainerRef = ref<HTMLElement | null>(null)
|
const customContainerRef = ref<HTMLElement | null>(null)
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
|
// Configuration
|
||||||
|
const runtimeConfig = useRuntimeConfig()
|
||||||
|
const staticUrl = runtimeConfig.public.staticUrl
|
||||||
|
|
||||||
const coerceToString = (value: unknown): string => {
|
const coerceToString = (value: unknown): string => {
|
||||||
if (typeof value === 'string') return value
|
if (typeof value === 'string') return value
|
||||||
@@ -132,14 +135,37 @@
|
|||||||
|
|
||||||
// custom_contents가 URL인지 확인하고 HTML 가져오기
|
// custom_contents가 URL인지 확인하고 HTML 가져오기
|
||||||
watch(
|
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 = ''
|
fetchedHtml.value = ''
|
||||||
return
|
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 = ''
|
let html = ''
|
||||||
if (isUrl(contentStr)) {
|
if (isUrl(contentStr)) {
|
||||||
@@ -533,4 +559,4 @@
|
|||||||
min-height: 20rem;
|
min-height: 20rem;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user