Files
vue-ts-example-2025/src/pages/demos/index.page.vue
严浩 aadf03edd0
Some checks failed
CI/CD Pipeline / playwright (push) Failing after 8m43s
CI/CD Pipeline / build-and-deploy (push) Has been skipped
chore: lint
2025-10-27 02:01:08 +08:00

32 lines
988 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>