admin管理员组文章数量:1318989
In Nuxt Content, how can a custom <ProseScript/>
component be implemented? MDC allows Vue components to be used inside Markdown but sometimes it would be super nice to just write a small component inline without putting it into the /components/content
folder.
VitePress allows for this syntax in Markdown:
---
hello: world
---
<script setup>
import { ref } from 'vue'
const count = ref(0)
</script>
## Markdown content
the count is: {{ count }}
In Nuxt Content, the source code for <ProseScript/>
is the following and it ouputs some text in the html. I thought of using a <script>
tag inside the <template>
tags and that gives an error: Tags with side effect (<script>
and <style>
) are ignored in client component templates.
<template>
<div v-if="isDev">
Rendering the <code>script</code> element is dangerous and is disabled by default. Consider implementing your own <code>ProseScript</code> element to have control over script rendering.
</div>
</template>
<script setup lang="ts">
defineProps({
src: {
type: String,
default: ''
}
})
const isDev = import.meta.dev
</script>
本文标签: vuejsImplement a custom ProseScript component in Nuxt ContentStack Overflow
版权声明:本文标题:vue.js - Implement a custom ProseScript component in Nuxt Content - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742055052a2418243.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论