Write a Nuxt 3 Vue 3 (composition API) component called ProseA.vue which provides a link…
- User
Write a Nuxt 3 Vue 3 (composition API) component called ProseA.vue which provides a link preview of markdown links on hover, e.g. about would show a preview modal (placed below the link) with the markdown rendered content of '/content/about.md'. Use ContentRendererMarkdown component to render JSON data (fetched using queryContent(file basename). Style the component well and use best programming practices.
Example usage of the functions:
Assistant
<template> <NuxtLink :href="href" @mouseenter="showPreview" @mouseleave="hidePreview"> <slot /> </NuxtLink> <div class="prose-a-preview" v-if="show"> <NuxtContent :file="path" /> </div> </template> <script lang="ts" setup> import { ref, onMounted, onBeforeUnmount } from 'vue' import { useAsyncData } from 'nuxt3' const props = defineProps({ href: { type: String, required: true } }) const show = ref(false) const path = ref('') const { data } = await useAsyncData('prose-a-data', async () => { const path = props.href.slice(1) + '.md' return queryContent(path).findOne() }) onMounted(() => { path.value = data.path }) const showPreview = () => { show.value = true } const hidePreview = () => { show.value = false } onBeforeUnmount(() => { show.value = false }) </script> <style scoped> .prose-a-preview { position: absolute; left: 0; top: calc(100% + 10px); width: 100%; max-width: 600px; padding: 20px; background: #fff; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); z-index: 999; display: flex; flex-direction: column; gap: 20px; } </style>
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.