JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container" id="app">
<div class="row">
<div class="col-md-8 offset-md-2">
<form action="/question" enctype="multipart/form-data" method="get" v-on:submit.prevent="onSubmit">
<div class="input-group">
<input type="text" class="form-control" placeholder="Say Something...">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button">Go!</button>
</span>
</div>
</form>
</div>
</div>
<div class="row" style="">
<div class="col-md-8 offset-md-2">
<chatarea :msg="get_msg()"></chatarea>
</div>
</div>
</div>
JavaScript
// Register components
Vue.component('chatarea', {
delimiters: ['${', '}'],
props: ['msg'],
template: '<textarea readonly="" rows="20">${msg}</textarea>',
})
// Create a root instance
var app = new Vue({
el: '#app',
delimiters: ['${', '}'],
data: {
messages: [
'Hello from Vue!',
'Other line...'
],
},
methods: {
get_msg: function () {
return this.messages.reverse().join('\n');
}
}
})