Riot定制标签没有加载(你好世界的例子)

时间:2015-07-04 01:50:07

标签: javascript riot.js

我有最基本的自定义标签,但它没有安装。此外,如果我使用riot.mount('*'),我会在riot.min.js

中收到此错误
Uncaught SyntaxError:
Failed to execute 'querySelectorAll' on 'Document': The provided selector is empty.

编译标签

riot.tag('test', '<div>Hello world!</div>', function(opts) {
});

索引文件:

<!doctype html>
<html>
<head></head>
<body>
  <test></test>
  <script src="https://cdn.jsdelivr.net/riot/2.2/riot.min.js"></script>
  <script src="tags/test.js" type="riot/tag"></script>
  <script>riot.mount('test')</script>
  <!-- <script>riot.mount('*')</script> throws error -->
</body>
</html>

1 个答案:

答案 0 :(得分:2)

哦混合了预编译和浏览器编译的语法。从我的标记引用中删除type="riot/tag"后,它正确安装。