<template>
  <v-container>
    <div class="">
      <v-btn @click="getEnv()">getEnv</v-btn>
      <v-btn @click="postMessage()">postMessage</v-btn>
    </div>
  </v-container>
</template>

<script>
export default {
  auth: false,
  mounted() {
    this.$wx.miniProgram.postMessage({
      data: {
        action: 'updateAppMessageShareData',
        params: {
          title: '双子星云手机',
          path: '/pages/home/home',
          imageUrl:
            location.origin +
            require('~/assets/image/activity/invite-user/bg@2x.png'),
          // promise: null,
        },
      },
    });
  },
  methods: {
    getEnv() {
      this.$wx.miniProgram.getEnv((res) => {
        console.log('🚀 ~ file: jweixin.vue ~ line 14 ~ getEnv ~ res', res);
      });
    },
    postMessage() {
      this.$wx.miniProgram.postMessage({
        data: {
          now: Date.now(),
        },
      });
    },
  },
};
</script>
