I am creating a project spa in vuejs/ I have created common components Header and footer which I want to includes in main App.vue.
I am sharing my Code structure below:
<template> <header></header> </template> <script> import Header from './components/Header.vue' // import Footer from 'components/Footer.vue' export default { name: 'App', components: { Header, // Footer } } </script>
header
and footer
are native html elements, you should name your components with uncommon names, for example name them AppHeader
and AppFooter
and use them like:
<template>
<AppHeader />
<!-- other content-->
<AppFooter />
</template>
<script>
import {AppHeader} from './components/AppHeader.vue'
import {AppFooter} from './components/AppFooter.vue'
export default {
name:'App',
components:{ AppHeader, AppFooter}
}
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.