先上报错:然后花了一早上,找到了罪魁祸首(不确定):<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>但是百思不得其解,报错的原因是什么?正常的原因又是什么?
添加回答
举报
0/150
提交
取消