[英]Riot custom tag not loading (hello world example)
I have the most basic possible custom tag, but it's not mounting. 我有最基本的自定义标签,但是没有安装。 Also if I use riot.mount('*')
I get this error in riot.min.js 另外,如果我使用riot.mount('*')
,那么在riot.min.js中也会收到此错误
Uncaught SyntaxError:
Failed to execute 'querySelectorAll' on 'Document': The provided selector is empty.
Compiled Tag 编译标签
riot.tag('test', '<div>Hello world!</div>', function(opts) {
});
Index file: 索引文件:
<!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>
Oh was mixing the pre-compiled and browser compiled syntax. 哦,混用了预编译和浏览器编译的语法。 After removing type="riot/tag"
from my tag reference it mounted correctly. 从我的标签引用中删除type="riot/tag"
,它可以正确安装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.