先上報錯:然后花了一早上,找到了罪魁禍首(不確定):<template v-if="paper.type == 'article'">
<div class="content" v-html="paper.front"></div>
</template>
<template v-else>
<div class="content">
<div class="block" v-for="photo in paper.front">
<div class="img" v-bind:style="{'background-image': 'url(' + photo.url + ')'}"></div>
<div class="remark">? {{photo.remark}}</div>
</div>
</div>
</template>注意if...else,如果去掉else,改成下面這樣,就OK了:<template v-if="paper.type == 'article'">
<div class="content" v-html="paper.front"></div>
</template>
<template v-if="paper.type == 'photo'">
<div class="content">
<div class="block" v-for="photo in paper.front">
<div class="img" v-bind:style="{'background-image': 'url(' + photo.url + ')'}"></div>
<div class="remark">? {{photo.remark}}</div>
</div>
</div>
</template>但是百思不得其解,報錯的原因是什么?正常的原因又是什么?
一個找不到原因的錯誤?
倚天杖
2018-10-20 10:14:12