Created
February 1, 2014 15:17
-
-
Save lxyuma/8753581 to your computer and use it in GitHub Desktop.
Ractive.js 公式pageのsample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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