<template>
  <div :type="type" :openid="openid" v-text="openid"/>
</template>

<script>
import {mapActions} from "vuex";

export default {
  name: "AiOpenData",
  props: ['type', 'openid'],
  methods: {
    ...mapActions(['injectJWeixin'])
  },
  mounted() {
    this.injectJWeixin().then(() => {
      WWOpenData.bind(this.$el)
      WWOpenData.on('error', res => {
        console.log(res)
      })
      WWOpenData.on('update', res => {
        console.log(res)
      })
    })
  }
}
</script>
