Files
vue-ts-example-2025/src/pages/demos/index.page.vue
严浩 33801ca211
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 1m34s
CI/CD Pipeline / build-and-deploy (push) Successful in 1m56s
style(eslint): enforce padding between blocks in vue components
2025-11-13 22:16:40 +08:00

33 lines
989 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="tsx">
import hljs from 'highlight.js/lib/core';
import json from 'highlight.js/lib/languages/json';
import type { FunctionalComponent } from 'vue';
hljs.registerLanguage('json', json);
definePage({ meta: { link: true } });
const FComponent: FunctionalComponent<{ prop: string }> = (props /* context */) => (
<>
<NBlockquote>
函数式组件文档:
<a
class="text-blue-500 hover:text-blue-600 transition-colors"
href="https://cn.vuejs.org/guide/extras/render-function#typing-functional-components"
rel="noopener noreferrer"
target="_blank"
>
Render Function & JSX
</a>
</NBlockquote>
<p class="my-4">这是一个函数式组件它接收到的 prop 值为</p>
<NCode code={JSON.stringify(props, null, 2)} language="json" hljs={hljs} />
</>
);
</script>
<template>
<NCard title="函数式组件TSX示例">
<FComponent prop="some-prop-value" />
</NCard>
</template>