<template> <div id="wx-share-to-home"> <div class="share-to-home" v-if="isFromShare == '1'" @click="handleGoHome">去首页</div> </div> </template> <script> import wx from 'weixin-js-sdk' import {mapActions,mapState} from 'vuex' export default { props: { }, data() { return { } }, watch: { }, computed:{ isFromShare(){ // console.log(this.$store.state.isLogin) return this.$store.state.isFromShare }, }, methods:{ ...mapActions(['setIsFromShareAction']), handleGoHome(){ this.setIsFromShareAction("0") this.$router.push({ path: "/" }); } }, mounted() { // this.$msgbox(this.isFromShare) }, } </script> <style scoped> .share-to-home{ position: fixed; bottom: 80px; right: 15px; width: 50px; height: 50px; border-radius:50px; background: #fff; text-align: center; line-height: 50px; font-size: 14px; color:#19181d; -moz-box-shadow:1px 1px 10px #B5B5B5; -webkit-box-shadow:1px 1px 10px #B5B5B5; box-shadow:1px 1px 10px #B5B5B5; z-index:888; } </style>