index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view>
  3. <home v-show="tabbarActive === 'home'" @switch-tab="switchTab" />
  4. <exhibitor v-if="tabbarActive === 'exhibitor'" @share="onShare" />
  5. <activity v-if="tabbarActive === 'activity'" />
  6. <user v-if="tabbarActive === 'user'" />
  7. <product v-if="tabbarActive === 'product'"></product>
  8. <van-dialog id="van-dialog" />
  9. <tab-bar :active.sync="tabbarActive"></tab-bar>
  10. <u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
  11. </view>
  12. </template>
  13. <script>
  14. import TabBar from '@/components/layout/tab-bar.vue'
  15. import UShareActionSheet from '@/components/common/u-share-action-sheet'
  16. import Home from '@/pages/index/home.vue'
  17. import Exhibitor from '@/pages/exhibitor/index.vue'
  18. import Activity from '@/pages/activity/index.vue'
  19. import User from '@/pages/user/index.vue'
  20. import PageLayout from "@/components/layout/page-layout";
  21. import Product from "@/pages/exhibitor/exhibit"
  22. export default {
  23. options: {
  24. styleIsolation: 'shared'
  25. },
  26. components: {
  27. PageLayout,
  28. TabBar,
  29. Home,
  30. Exhibitor,
  31. Activity,
  32. User,
  33. UShareActionSheet,
  34. Product
  35. },
  36. watch: {
  37. '$store.getters.page': {
  38. handler(val) {
  39. this.tabbarActive = val[val.length-1]
  40. }
  41. }
  42. },
  43. data() {
  44. return {
  45. tabbarActive: 'home',
  46. showShare: false,
  47. shareInfo: null
  48. }
  49. },
  50. onLoad(options) {
  51. if (options.tab) {
  52. this.tabbarActive = options.tab
  53. }
  54. },
  55. created() {
  56. },
  57. methods: {
  58. switchTab(active) {
  59. this.tabbarActive = active
  60. },
  61. onShare(e) {
  62. this.shareInfo = e.detail
  63. this.showShare = true
  64. },
  65. onShareAppMessage: function (res) {
  66. if (res.from === 'button') {
  67. if (this.shareInfo) {
  68. return this.shareInfo
  69. }
  70. }
  71. this.shareInfo = null
  72. this.showShare = false
  73. return {
  74. title: '慕尼黑上海电子生产设备展',
  75. path: '/pages/index/index',
  76. imageUrl: 'https://oss.productronicachina.com.cn/resources/common/up/0000001002/20250221/67b829f60c212.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
  77. }
  78. },
  79. onClickSearch() {
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. </style>