<template>
	<view class="content">
		<home v-if="tabbarActive === 'home'" @switch-tab="tabbarActive = 'exhibitor'" />
		<exhibitor v-if="tabbarActive === 'exhibitor'" @share="onShare" />
		<activity v-if="tabbarActive === 'activity'" />
		<user v-if="tabbarActive === 'user'" />
		<van-dialog id="van-dialog" />
		<tab-bar :active.sync="tabbarActive"></tab-bar>
		<u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
	</view>
</template>

<script>
	import TabBar from '@/components/layout/tab-bar.vue'
	import UShareActionSheet from '@/components/common/u-share-action-sheet'
	import Home from '@/pages/index/home.vue'
	import Exhibitor from '@/pages/exhibitor/index.vue'
	import Activity from '@/pages/activity/index.vue'
	import User from '@/pages/user/index.vue'

	export default {
		options: {
			styleIsolation: 'shared'
		},
		components: {
			TabBar,
			Home,
			Exhibitor,
			Activity,
			User,
			UShareActionSheet
		},
		data() {
			return {
				tabbarActive: 'home',
				showShare: false,
				shareInfo: null
			}
		},
		onLoad(options) {
			if (options.tab) {
				this.tabbarActive = options.tab
			}
		},
		created() {
			
		},
		methods: {
			onShare(e) {
				this.shareInfo = e.detail
				this.showShare = true
			},
			onShareAppMessage: function (res) {
				if (res.from === 'button') {
					if (this.shareInfo) {
						return this.shareInfo
					}
				}
				this.shareInfo = null
				this.showShare = false
				return {
					title: '慕尼黑上海电子生产设备展',
					path: '/pages/index/index',
					imageUrl: 'https://oss.starify.cn/prod/starify/up/0001018678/20241108/672da5a7dd374.png?x-oss-process=image/resize,w_600,h_600,limit_0,m_pad'
				}
			},
			onClickSearch() {

			}
		}
	}
</script>

<style lang="scss">
</style>