In the Vue.js Docs, they say you have to use v-component instead of the direct component-tag when using a component in a table. But this doesn't work: Do you have any workaround - even with CSS formatting - or fix?
@extends('app')
@section('content')
<div class="table-responsive" id="vueTable">
<table class="table-striped">
<thead>
<td class="table-cell"><strong>Aktion</strong></td>
</thead>
<tr v-component="members" class="success" v-repeat="members" inline-template>
<td>@{{ $data | json }}</td>
</tr>
</table>
</div>
@endsection
@section('footer')
<script src="/js/vue.js"></script>
<script>
var v = new Vue({
el: '#vueTable',
data: {
members: [{
prename: 'Deniz',
lastname: 'Adanc'
}]
},
components: {
members: {
template: ''
}
}
});
</script>
@endsection
I was pulling my hair out trying to fix this one until I realized I did not have the latest Vue.js installed.
Gladly, this issue was found to be a bug and is fixed on version 12.6 of Vue.js
You can download the latest here or simply go to vuejs.org
Evan made breaking changes in 1.0 again. After many failed attempts this is the combination of html/javascript that works for me when trying to include custom component in a table (which in turn is another parent component):
HTML file:
JavaScript snippet:
There are two components here:
my-comments
(which is a table) andmy-comment
(which is a row/rows in the table).comment
fromv-for
loop is passed as adata
property and remapped insidemy-comment
to the actual data ofmy-comment
(this.comment = this.data.comment
).It looks rather ugly and not completely intuitive but at least it works.