简体   繁体   中英

Riot.js 4, how to mount nested tags

I'm creating application in Riot.js 4 and using in-browser compilation (for prototyping), everything was working fine in Riot.js 3. However, when I use nested tags, only the root tag is mounted and not any child tags. If I mount every nested tag separately, they are mounted fine.

Minimal example is here: https://plnkr.co/edit/hxXUvmsjEgE3eDAF

<main>
    <p>main tag</p>
    <footer></footer>
</main>

<footer>
    <p>footer</p>
</footer>

riot.mount('main')

If I mount also nested component, it works, see here: https://plnkr.co/edit/UDkdZ55ynTYz9uxL

riot.mount('main')
riot.mount('footer')

What is the correct way to do this?

in riot you cannot use the same name of another existing tag, so, because footer is an existing tag you should change the name of "footer" component and it will work just fine! ;)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM