Last active
August 29, 2015 14:14
-
-
Save juriansluiman/0695b0845df6f668962c to your computer and use it in GitHub Desktop.
Test riot-js file for a bug report
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
<comment-box> | |
<h1>{ opts.title }</h1> | |
<comment-list url={ opts.url } comments={ comments } /> | |
<comment-form url={ opts.url } comments={ comments } /> | |
// Start with some in-memory list of comments | |
this.comments = [{'name': 'Tom', 'message': 'Hi there'}, {'name': 'Paul', 'message': 'Great job'}] | |
</comment-box> | |
<comment-list> | |
<comment each={ opts.comments } name={ this.name } message={ this.message } /> | |
</comment-list> | |
<comment-form> | |
<form onsubmit={add}> | |
<input type="text" placeholder="Your name" name="name"> | |
<textarea cols="40" rows="40" placeholder="Say something..." name="message"></textarea> | |
<input type="submit" value="Post"> | |
</form> | |
add(e) { | |
var data = { | |
'name': this.name.value, | |
'message': this.message.value | |
} | |
// Add the new comment to the list | |
// Note: this does **NOT** work; bug in riot? | |
this.parent.comments.push(data); | |
} | |
</comment-form> | |
<comment> | |
<div> | |
<h2>{ opts.name }</h2> | |
<p>{ opts.message }</p> | |
</div> | |
</comment> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will look into this today.
btw: Did you try
parent.update()
?