Riot.mount(*)没有任何影响

Gro*_*the 3 html javascript riot.js

这里的简单问题但遗憾的是无法解决.如标题中所述,我无法让Riot显示其自定义标记的内容.

<!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>
Run Code Online (Sandbox Code Playgroud)

hello.js是生成的js,这里是它的代码:

riot.tag('hello', '<div> asdasd </div>', function(opts) {
});
Run Code Online (Sandbox Code Playgroud)

这是它的HTML:

<hello>
    <div>
        asdasd
    </div>
    <script>
    </script>
</hello>
Run Code Online (Sandbox Code Playgroud)

edi*_*999 5

在声明标签之前,您无法挂载标签.

您需要按此顺序执行:

包括骚乱:

<script type="text/javascript" src="node_modules/riot/riot.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

声明你的标签:

<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>
Run Code Online (Sandbox Code Playgroud)

挂载您声明的标签:

<script type="text/javascript"> riot.mount('*'); </script>
Run Code Online (Sandbox Code Playgroud)