色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

vue.js - vue獲取mongodb中的數(shù)據(jù)起初顯示未定義,但還是可以渲染

瀏覽:260日期:2024-03-29 11:55:28

問題描述

[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 }}&nbsp;發(fā)布</span> <span v-if='topic.meta.createAt != topic.meta.updateAt' class='update'>{{ topic.meta.updateAt | timeToNow }}&nbsp;更新</span> </p>

這是 一個組件 topic是通過我的getters會獲取到的,通過actions向mongodb請求數(shù)據(jù),看上去一切都很正常。。。convertTag和timeToNow都是我自己寫的filter

問題解答

回答1:

這樣的你應該先判斷存在topic.meta對象在去去它的屬性,這樣就不報錯了,報錯的原因就是你沒有獲得meta數(shù)據(jù)的時候去獲取它的屬性

<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 v-if='!!topic.meta' class='ask'>{{ topic.meta.createAt | timeToNow }}&nbsp;發(fā)布</span> <span v-if='!!topic.meta && topic.meta.createAt != topic.meta.updateAt' class='update'>{{ topic.meta.updateAt | timeToNow }}&nbsp;更新</span> </p>回答2:

topic.meta = undefined.

標簽: vue
主站蜘蛛池模板: 曰本女同互慰高清在线观看 | 免费看一级欧美毛片视频 | 美女扒开腿让男人桶尿口 | 自怕偷自怕亚洲精品 | 午夜成年人网站 | 一级做性色a爰片久久毛片免费 | 欧美日韩一区二区三区视频在线观看 | 黄色大秀视频 | 亚洲精品一区二区三区 | 日本在线观看免费视频 | 黄色美女视频 | 国产乱码一区二区三区四 | 国产精品99r8免费视频2022 | 美女视频永久黄网站在线观看 | 欧美成人激情 | 最新国产午夜精品视频成人 | 成年女人毛片免费视频 | 久久久www成人免费精品 | 国产日韩免费 | 在线亚洲精品 | 131美女爱做免费毛片 | 免费在线视频成人 | a级国产乱理伦片在线观看99 | 日本特爽特黄特刺激大片 | 久久精品国产欧美成人 | 欧美精品黄页免费高清在线 | 欧美日本一区视频免费 | 欧美成人亚洲国产精品 | 在线视频 亚洲 | 国产高清在线精品一区二区 | 92精品国产自产在线 | 特黄aa级毛片免费视频播放 | 男女午夜免费视频 | 日本黄色毛片 | 中文精品爱久久久国产 | 亚洲精品高清国产一久久 | 日韩在线国产 | 久久精品国产99国产精品亚洲 | 国产偷怕| 亚洲免费观看 | 91亚洲精品国产第一区 |