Files
web-temp/layers/components/blocks/StoveGnb.vue

62 lines
1.5 KiB
Vue

<template>
<div id="stove-wrapper" class="relative z-[5]" />
</template>
<script setup lang="ts">
import { useGameDataStore } from '#layers/stores/useGameDataStore'
const runtimeConfig = useRuntimeConfig()
const { locale, availableLocales } = useI18n()
const { gameData } = useGameDataStore()
const stoveInflowPath = runtimeConfig.public.stoveInflowPath
const stoveGameNo = runtimeConfig.public.stoveGameNo
const gnbData = gameData?.stove_gnb
const languageCodes = computed(() => {
if (Array.isArray(availableLocales)) {
return availableLocales.map(
(localeCode: any) => localeCode.code || localeCode
)
}
return [locale]
})
function loadGnb(locale: string) {
locale = locale.toLowerCase()
const gnbOption = {
wrapper: '#stove-wrapper',
isResponsive: true,
skin: gnbData?.skin_type || 'gnb-dark-mini',
widget: {
gameListAndService: false,
languageSelect: false,
notification: false,
stoveDownload: false,
},
global: {
userGds: true,
defaultSelectedLanguage: locale || 'en',
languageCoverages: languageCodes.value,
},
loginMethod: {
params: {
inflow_path: stoveInflowPath,
game_no: stoveGameNo,
show_play_button: gnbData?.stove_install_button_visible || 'Y',
},
redirectCurrentPage: true,
windowTitle: undefined,
},
}
const cpHeader = new (window as any).cp.Header(gnbOption)
cpHeader.render()
}
onMounted(() => {
loadGnb(locale.value)
})
</script>