FComponent
All checks were successful
CI / cache-and-install (push) Successful in 1m26s

This commit is contained in:
严浩
2024-08-22 15:10:38 +08:00
parent 1553ec013e
commit 7e1637ccce

View File

@ -1,4 +1,6 @@
<script lang="ts" setup> <script lang="tsx" setup>
import type { FunctionalComponent } from 'vue';
useHead({ useHead({
// Titles // Titles
title: 'Hello World', title: 'Hello World',
@ -13,6 +15,14 @@ useHead({
definePage({ definePage({
alias: '/', alias: '/',
}); });
// https://cn.vuejs.org/guide/extras/render-function#typing-functional-components
const FComponent: FunctionalComponent<{ prop: string }> = (props, context) => (
<>
<div>This is a functional component with prop: {props.prop}</div>
<div>{props.prop}</div>
</>
);
</script> </script>
<template> <template>
@ -24,4 +34,5 @@ definePage({
<li><router-link :to="{ name: '中文页面' }">中文-页面.page.vue</router-link></li> <li><router-link :to="{ name: '中文页面' }">中文-页面.page.vue</router-link></li>
<li><router-link :to="{ name: 'MdPage' }">Markdown Page</router-link></li> <li><router-link :to="{ name: 'MdPage' }">Markdown Page</router-link></li>
</ul> </ul>
<FComponent prop="Hello World" />
</template> </template>