Skip to content

Instantly share code, notes, and snippets.

@lxyuma
Created February 1, 2014 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lxyuma/8753581 to your computer and use it in GitHub Desktop.
Save lxyuma/8753581 to your computer and use it in GitHub Desktop.
Ractive.js 公式pageのsample
<html>
<script src="http://cdnjs.cloudflare.com/ajax/libs/ractive.js/0.3.7/ractive.min.js"></script>
<body>
<div id="result">
</div>
<p>※consoleから、ractive.set('messages.unread', 5); とコピペして実行してみると</p>
</body>
<script id='myTemplate' type="text/ractive">
<p>こんにちわ{{user}} さん。
<strong>{{messages.unread}} 件の未読メッセージがあります。</strong>
</p>
</script>
<script type="text/javascript">
var ractive = new Ractive({
el: "#result",
template: "#myTemplate",
data: {
user: '太郎',
messages: { total: 11, unread: 4 }
}
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment