javascript - Riot.mount(*) doesnt have any effect -
simple problem here unfortunately can't solve. mentioned in title, can't riot show contents of custom tag.
<!doctype html> <html> <head></head> <body> <hello></hello> <script type="text/javascript" src="node_modules/riot/riot.min.js"></script> <script type="text/javascript"> riot.mount('*'); </script> <script type="text/javascript" src="bower_components/lodash/lodash.min.js"></script> <script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script> <script type="text/javascript" src="bower_components/toastr/toastr.min.js"></script> <script type="text/javascript" src="js/init.js"></script> <script type="text/javascript" src="js/config.js"></script> <script type="text/javascript" src="js/util.js"></script> <script type="text/javascript" src="js/hello.js"></script> </body>
the hello.js generated js, here code:
riot.tag('hello', '<div> asdasd </div>', function(opts) { });
and here html:
<hello> <div> asdasd </div> <script> </script> </hello>
you can't mount tag before declaring it.
you need in order:
include riot:
<script type="text/javascript" src="node_modules/riot/riot.min.js"></script>
declare tags:
<script type="text/javascript" src="js/init.js"></script> <script type="text/javascript" src="js/config.js"></script> <script type="text/javascript" src="js/util.js"></script> <script type="text/javascript" src="js/hello.js"></script>
mount declared tags:
<script type="text/javascript"> riot.mount('*'); </script>
Comments
Post a Comment