Closed sadeghbarati closed 6 years ago
sorry its my bad
i dont use ./
for import
import { Header, Main, Sidebar, Footer } from 'homeComponents/index'
im using Moon and Webpack Its very good repository Thanks to @imlinus to create this boilerplate https://github.com/imlinus/MoonJs-WebPack-ES6-SCSS-Boiler
Another qustion i have how to write currently in template: `` ?? because one Component will rendered for example just Header will be shown :(
template: `<Header></Header><Main></Main><Footer></Footer>`
or
`<Header></Header>
<Main></Main>
<Footer></Footer>`
or
`<Header/><Main/><Footer/>`
any idea ?? πΆ π€
I fount my problem... to be able for include components
into another component template
u must create a wrapper or parent for them and then define ur module layout like Header Main Footer
solution π
export const Home = Moon.component('Home', {
template: `<div class="home">
<Header/>
<Aside/>
</div>`,
})
GL & HF π
All components in Moon need to have one root element, and are registered globally so you don't need to import
them. You just need one Moon
that registers all components and they will automatically be available.
for understanding more i include example
i have
home.js
andhome.js
include components likeheader
sidebar
main
andfooter
each component a separate file is created by
Moon.component
and linked in one script and exported for import inhome.js
home.js
my qustion is about home js template: `` how to use another component inside it
app.js
index.html