NEZ-1235 fix: 前端搜索框组件历史记录出现 undefined

This commit is contained in:
zhangyu
2021-11-15 11:18:41 +08:00
parent f7a85b2d6b
commit 41291f758f

View File

@@ -14,7 +14,8 @@
<li v-for="(val,ind) in history_once" @click="select_history(ind,$event)" :key="ind" :id="'search-history-pick-'+ind"> <li v-for="(val,ind) in history_once" @click="select_history(ind,$event)" :key="ind" :id="'search-history-pick-'+ind">
<span v-for="(item,key) in val" :key="key"> <span v-for="(item,key) in val" :key="key">
<span class="name">{{item.name}}: </span> <span class="name">{{item.name}}: </span>
<span class="value">{{item.val+' '}}</span> <span class="value" v-if="item.val">{{item.val+' '}}</span>
<span class="value" v-else>{{' '}}</span>
</span> </span>
</li> </li>
</ul> </ul>
@@ -964,6 +965,7 @@ export default {
restructure_historyDate () { restructure_historyDate () {
if (localStorage.getItem('nz-history-' + this.where) !== undefined && localStorage.getItem('nz-history-' + this.where) !== null) { if (localStorage.getItem('nz-history-' + this.where) !== undefined && localStorage.getItem('nz-history-' + this.where) !== null) {
this.history_once = JSON.parse(localStorage.getItem('nz-history-' + this.where)) this.history_once = JSON.parse(localStorage.getItem('nz-history-' + this.where))
console.log(this.history_once)
} }
}, },
clear_search_list (e) { clear_search_list (e) {