簡體   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