diff --git a/pages/home/newZone.vue b/pages/home/newZone.vue index c185413..a76ff92 100644 --- a/pages/home/newZone.vue +++ b/pages/home/newZone.vue @@ -36,7 +36,7 @@ - + @@ -53,6 +53,9 @@ + + 暂无数据 + { this.details = res.data - this.tabs = res.data.categories - this.handleClick(0, this.tabs[0]) + this.tabs = Array.isArray(res.data.categories) ? res.data.categories : [] + if (this.tabs.length > 0) { + this.handleClick(0, this.tabs[0]) + } else { + this.products = [] + } }) }, computed: { @@ -112,7 +119,7 @@ export default{ methods: { handleClick(index, tab) { this.activeIndex = index - this.products = tab.products + this.products = Array.isArray(tab && tab.products) ? tab.products : [] }, handleChange(e) { this.current = e.detail.current @@ -144,6 +151,17 @@ export default{ justify-content: space-between; flex-wrap: wrap; } +.empty-wrap{ + min-height: 260rpx; + display: flex; + align-items: center; + justify-content: center; +} +.empty-text{ + font-size: 28rpx; + color: #999999; + text-align: center; +} .tab-line{ position: absolute; bottom: 0;