封装子组件
<template>
<div class="card">
<div class="card-header">
<div>标题</div>
<div>副标题</div>
</div>
<div v-if='content' class="card-content">
{{content}}
</div>
</div>
</template>
<script setup lang="ts">
type Props = {
content:string
}
defineProps<Props>()
</script>
main.ts 全局注册
import { createApp } from "vue";
import App from "./App.vue";
import "./assets/css/reset/index.less";
import Card from "./components/Card/index.vue";
createApp(App).component("Card", Card).mount("#app");