在项目目录src/components下分别新建.vue的header.vue和footer.vue文件
header.vue

<script setup>

</script>

<template>

<h3>header</h3>

</template>

<style scoped>

</style>

footer.vue

<script setup>

</script>

<template>
<h3>footer</h3>
</template>

<style scoped>

</style>

在app.vue中导入header.vue和footer.vue

<script setup>

    import Header from "./components/header.vue"
    import Footer from "./components/footer.vue"


</script>

<template>
    <Header/>
<h3>hello word</h3>
    <Footer/>

</template>

<style scoped>

</style>

注意:导入组件命名方式,首字母必须大写

标签: none

评论已关闭