[英]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.