Skip to content
Snippets Groups Projects
Commit 8f9fdfe6 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

no need to refine with to attribute

parent 7b6b879d
No related branches found
No related tags found
No related merge requests found
Pipeline #112571 passed with stages
in 5 minutes and 49 seconds
......@@ -12,7 +12,9 @@ RUN npm install
### STAGE: Dev
FROM node:19.5-bullseye-slim as dev
ARG BASE_URL=/
ENV NUXT_APP_BASE_URL=${BASE_URL}
WORKDIR /usr/src/app
COPY --from=install /usr/src/app ./
COPY . /usr/src/app
......
......@@ -27,20 +27,20 @@ const sections = ref([
]);
const computedSections = computed(() => {
return sections.value.map(section => {
// const computedSections = computed(() => {
// return sections.value.map(section => {
if (section?.to) {
const { refinedUrl } = useRefinedUrl(section.to)
return { ...section, to: refinedUrl.value }
}
else {
return section
}
// if (section?.to) {
// const { refinedUrl } = useRefinedUrl(section.to)
// return { ...section, to: refinedUrl.value }
// }
// else {
// return section
// }
})
})
// })
// })
const drawer = ref(true);
......@@ -76,7 +76,7 @@ const computedNavigation = computed(() => {
</span>
</v-app-bar-title>
<template #append v-if="!mobile">
<v-btn v-for="section in computedSections" :key="section.id" color="primary" :to="section?.to ?? null"
<v-btn v-for="section in sections" :key="section.id" color="primary" :to="section?.to ?? null"
:href="section?.href ?? null" exact>
{{ section.label }}
</v-btn>
......
import { join } from "path";
import { withTrailingSlash, withLeadingSlash, joinURL } from "ufo";
export function useRefinedUrl(url: string | Ref<string>) {
console.log(useRuntimeConfig().app.baseURL)
const refinedUrl = computed(() => {
const sanitzedUrl = toValue(url)
if (sanitzedUrl.startsWith("/") && !sanitzedUrl.startsWith("//")) {
const _base = withLeadingSlash(
withTrailingSlash(useRuntimeConfig().app.baseURL)
);
console.log(_base)
if (_base !== "/" && !sanitzedUrl.startsWith(_base)) {
return joinURL(_base, sanitzedUrl);
}
......
......@@ -4,6 +4,8 @@ services:
build:
context: .
target: dev
args:
BASE_URL: /wiki/
container_name: nuxt
environment:
HOST: 0.0.0.0
......
......@@ -48,6 +48,8 @@ const systems = computed(() => {
};
});
});
</script>
<template>
<v-card flat color="transparent">
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment