index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view class="news-index">
  3. <nav-bar title="新闻" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view :tabbar-conflict="false">
  5. <view class="main-container">
  6. <u-tabs :active.sync="tabActive" :tabs="tabs" tab-style="default" @change="tabChange"/>
  7. <van-empty v-if="newsList.length === 0" description="暂无数据" />
  8. <view v-else class="news-list">
  9. <template v-for="(item, index) in newsList">
  10. <news-item :item="item" :key="index" />
  11. </template>
  12. </view>
  13. <disclaimer-text></disclaimer-text>
  14. </view>
  15. </u-scroll-view>
  16. </view>
  17. </template>
  18. <script>
  19. import NavBar from '@/components/layout/nav-bar'
  20. import UTabs from '@/components/common/u-tabs'
  21. import UScrollView from '@/components/common/u-scroll-view'
  22. import NewsItem from '@/pages/news/components/news-item.vue'
  23. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  24. export default {
  25. options: {
  26. styleIsolation: 'shared'
  27. },
  28. components: {
  29. NavBar,
  30. UTabs,
  31. UScrollView,
  32. NewsItem,
  33. DisclaimerText
  34. },
  35. data() {
  36. return {
  37. tabActive: 'exhibition',
  38. tabs: [{
  39. label: '展会新闻',
  40. value: 'exhibition'
  41. }, {
  42. label: '展商新闻',
  43. value: 'exhibitor'
  44. }],
  45. newsList: [{}, {}, {}, {}, {}, {}]
  46. }
  47. },
  48. onLoad(options) {
  49. if (options.type) {
  50. this.tabActive = options.type
  51. }
  52. },
  53. created() {},
  54. methods: {
  55. tabChange() {
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss">
  61. .news-list{
  62. display: grid;
  63. grid-template-columns: 1fr;
  64. grid-row-gap: 18rpx;
  65. margin-top: 28rpx;
  66. }
  67. </style>