繁体   English   中英

防暴自定义标签未加载(Hello World示例)

[英]Riot custom tag not loading (hello world example)

我有最基本的自定义标签,但是没有安装。 另外,如果我使用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>

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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