[英]Riot.js Tags are Not Found
我對此不知所措。 我過去曾使用過Riot(盡管幾個月前)。 據我所知,我正在遵循與過去相同的過程,甚至嘗試從Riot.js示例中復制逐字記錄,並且一直看不到我的標簽呈現並收到此錯誤
在XMLHttpRequest.Er.n.onreadystatechange(riot%2Bcompiler.min.js:2)的Function.Sr.error(riot%2Bcompiler.min.js:2)上找不到“未捕獲的錯誤:“ / Tags / sample.tag” “
我所擁有的非常簡單(只是試圖找出我所缺少的)。 這是我的標簽文件:
<sample>
<h3>{ message }</h3>
<ul>
<li each={ techs }>{ name }</li>
</ul>
<script>
this.message = 'Hello, Riot!'
this.techs = [
{ name: 'HTML' },
{ name: 'JavaScript' },
{ name: 'CSS' }
]
</script>
<style>
:scope {
font-size: 2rem
}
h3 {
color: #444
}
ul {
color: #999
}
</style>
</sample>
這是我要在其上呈現的頁面:
@{
ViewBag.Title = "Home Page";
}
<head>
<title>Riot</title>
<script src="https://rawgit.com/riot/riot/master/riot%2Bcompiler.min.js"></script>
</head>
<body>
<h1>Riot Tags</h1>
<sample></sample>
<script type="riot/tag" src="~/Tags/sample.tag">
</script>
<script>riot.mount('sample')</script>
</body>
這只是一個例子。 在這一點上,我已經嘗試了許多標簽和頁面渲染。 謝謝您的幫助。
*注意:這是一個MVC項目
一個問題是,如果您要通過鏈接地址訪問防暴庫/編譯器,則需要將腳本放在正文中而不是頭部中
我也不確定標簽的文件路徑中“〜”的用例。 所以我省略了它,並為我呈現。 希望這可以幫助。
<!DOCTYPE html>
<html>
<head>
<title>Riot</title>
</head>
<body>
<h1>Riot Tags</h1>
<script src="https://rawgit.com/riot/riot/master/riot%2Bcompiler.min.js"></script>
<sample></sample>
<script type="riot/tag" src="/tags/sample.tag"></script>
<script>riot.mount('sample')</script>
</body>
</html>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.