<!--姜枫 2021.04.13-->
<style lang="scss" scoped>
.app-content {
}
</style>
<template>
  <div class="app-content">
			<button type="default" open-type="share">点击分享</button>
			参数展示：{{JSON.stringify(shareInfo.shopId)}}
  </div>
</template>
<script>
import { ghsInfo } from "@/api/ghs/index";
export default {
  name: 'Share',
  data () {
    return {
					shareInfo:'',
          title: ''
    }
  },
	onShareAppMessage(res) {
  	let {shopId,id,name} = this.shareInfo;
		if (res.from === 'button') {// 来自页面内分享按钮
			console.log(res.target)
		}
		return {
			title: this.title,
			path: `/pagesPurchase/ghsProduct?shopId=${shareInfo.shopId}&id=${shareInfo.id}&name=${shareInfo.name}`
		}
	},
  onLoad () {
			if(uni.getStorageSync('extraData')){
				this.shareInfo = uni.getStorageSync('extraData').referrerInfo.extraData;
			}
      ghsInfo({shopId: this.shareInfo.shopId}).then(res => {
        console.log(res)
        uni.setNavigationBarTitle({
        　　title:res.data.name
        })
        this.title = res.data.name
      }).catch(err => {console.log(err)})
  },
  methods: {
  }
}
</script>

