The reason why you don’t want to configure nuxt.config.ts is because you don’t want to install the js of the map on every page.
In ~/pages/test.vue
<script lang="ts" setup>
useHead({
script: [
{
type: 'text/javascript',
src: 'https://js.api.here.com/v3/3.1/mapsjs-core.js',
},
{
type: 'text/javascript',
src: 'https://js.api.here.com/v3/3.1/mapsjs-service.js',
},
]
})
onMounted(() => {
// How to use the global H object at this location
let platform = new H.service.Platform({
apikey: 'test',
})
})
</script>
<template>
<div>...</div>
</template>
Ask God to help me
I tried to dynamically add the map js by regularizing the route in “~/app.vue”, this method works in the case of SSG, but it doesn’t work in the local dev environment
New contributor
yondmn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.