[Vue warn]: Error when evaluating expression "topic.meta.createAt != topic.meta.updateAt": TypeError: Cannot read property 'createAt' of undefined (found in component: <v-article>)
[Vue warn]: Error when evaluating expression "topic.meta.createAt": TypeError: Cannot read property 'createAt' of undefined (found in component: <v-article>)
这是报错信息,下面是我的代码部分。
<h1>{{ topic.title }}</h1>
<p class="info">
<a v-for="tag in topic.tag" v-link="{name: 'tab', params: {tab: tag, page: 1}}" class="tag">
{{ tag | convertTag}}
</a>
<a class="name"><strong>radical</strong></a>
<span class="ask">{{ topic.meta.createAt | timeToNow }} 发布</span>
<span v-if="topic.meta.createAt != topic.meta.updateAt" class="update">{{ topic.meta.updateAt | timeToNow }} 更新</span>
</p>
这是 一个组件 topic是通过我的getters会获取到的,通过actions向mongodb请求数据,看上去一切都很正常。。。
convertTag和timeToNow都是我自己写的filter
In this case, you should first determine that the topic.meta object exists and get its attributes, so that no error is reported.
The reason for the error is that you get its attributes without getting the meta data
topic.meta = undefined.