VueJS 렌더링에 문제가 있습니다. 아약스 당 데이터를 가져 왔습니다. 초기 렌더링시 테이블 행이 올바르게 렌더링되지만 업데이트 된 요소를 다시 렌더링 할 때 올바르게 렌더링되지 않습니다. 당신이 볼 수 있듯이, 행 1 잘 렌더링 Rendered TableVueJS 2 재 렌더링 테이블
:
여기 사진입니다. 그러나 다시 렌더링 된 2 번 행에서는 tds가 반전됩니다.
var renderings = new Vue({
el: '#renderings',
data: function() {
return {
hasUnprocessedRenderings: false,
renderings: {}
};
},
methods: {
clearData: function() {
this.renderings = {};
},
updateData: function() {
this.$http.get('http://some-url.com/renderings').then(function (response) {
this.renderings = response.body.renderings;
this.hasUnprocessedRenderings = response.body.hasUnprocessedRenderings;
if (this.hasUnprocessedRenderings) {
setTimeout(this.updateData, 10000);
}
});
}
},
mounted: function() {
this.updateData();
}
});
내 HTML :
여기 내 코드의
<div id="renderings">
<table class="table table-striped table-hover table-bordered" style="margin bottom: 0;">
<thead>
<tr>
<th>Personalisierung</th>
<th>Format</th>
<th>Download</th>
<th></th>
</tr>
</thead>
<tbody>
<template v-for="rendering in renderings">
<tr>
<td>{{rendering.personalizationName}}</td>
<td>{{rendering.renderTypeName}}</td>
<template v-if="rendering.DOCUMENT_URL">
<td><a :href="rendering.DOCUMENT_URL">{{rendering.DOCUMENT_URL}}</a></td>
<td>
<ul class="list-inline" style="margin-bottom: 0;">
<li><a :href="'http://some-url.com?pid='+rendering.PROCESS_ID" title="refresh"><i class="fa fa-refresh" aria-hidden="true"></i></a></li>
<li><a :href="'http://some-url.com?pid='+rendering.PROCESS_ID" title="delete"><i class="fa fa-trash-o" aria-hidden="true"></i></a></li>
</ul>
</td>
</template>
<template v-else>
<td colspan="2" style="text-align: center;">
<i class="fa fa-cog fa-spin fa-fw"></i>
<span>In Bearbeitung..</span>
</td>
</template>
</tr>
</template>
</tbody>
</table>
</div>
그래서 내 질문 : 어떻게 행이 올바르게 다시 렌더링지고 있음을, 해결할 수 있습니까?
도움 주셔서 감사합니다. :-)
수정 # 1 : 다음은 문제도 발생하는 jsfiddle,이다 : https://jsfiddle.net/dt1kt06g/
템플릿의 구문 오류 (' Aletheios
지금 jsfiddle을 코드와 데이터로 추가하고 구문 오류를 수정했습니다. 문제가 발생합니다. – Hendrik