test
This commit is contained in:
+1
-1
@@ -16,4 +16,4 @@ export default defineContentConfig({
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { withTrailingSlash, withLeadingSlash, joinURL } from "ufo"
|
||||
import { useRuntimeConfig, computed } from "#imports"
|
||||
import { computed } from "#imports"
|
||||
|
||||
import ImageComponent from "#build/mdc-image-component.mjs"
|
||||
|
||||
@@ -43,17 +42,11 @@ const props = defineProps({
|
||||
type: String,
|
||||
default: "lazy" // eager, lazy
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
const refinedSrc = computed(() => {
|
||||
if (props.src?.startsWith("/") && !props.src.startsWith("//")) {
|
||||
const _base = withLeadingSlash(withTrailingSlash(useRuntimeConfig().app.baseURL))
|
||||
if (_base !== "/" && !props.src.startsWith(_base)) {
|
||||
return joinURL(_base, props.src)
|
||||
}
|
||||
}
|
||||
return props.src
|
||||
})
|
||||
return getPublicPath(props.src);
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -41,7 +41,7 @@ a h4:hover {
|
||||
</style>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useAsyncData, queryCollection } from "#imports";
|
||||
import { useAsyncData, queryCollection } from "#imports"
|
||||
|
||||
const { data: articles } = await useAsyncData("articles", () => queryCollection("content").order("date", "DESC").all())
|
||||
const { data: articles } = await useAsyncData("articles", () => queryCollection("content").order("date", "DESC").all());
|
||||
</script>
|
||||
|
||||
@@ -1 +1,16 @@
|
||||
import { withTrailingSlash, withLeadingSlash, joinURL } from "ufo"
|
||||
import { useRuntimeConfig } from "#imports"
|
||||
|
||||
export const isDev = process.env.NODE_ENV === "development";
|
||||
|
||||
export const getPublicPath = function (path: string) {
|
||||
if (path?.startsWith("/") && !path.startsWith("//")) {
|
||||
const _base = withLeadingSlash(withTrailingSlash(useRuntimeConfig().app.baseURL));
|
||||
if (_base !== "/" && !path.startsWith(_base)) {
|
||||
return joinURL(_base, path);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
// datetime format
|
||||
|
||||
Reference in New Issue
Block a user