<template>
  <OpenWxMiniProgram
    :redirectUrl="redirectUrl"
    ref="fbtOpenWxMiniProgram"/>
</template>

<script>
import OpenWxMiniProgram from '../common/openWxMiniProgram'
import { Toast } from 'vant'

export default {
  name: 'index',
  components: {
    OpenWxMiniProgram
  },
  data () {
    return {
      redirectUrl: ''
    }
  },
  mounted () {
    const { redirectUrl } = this.$route.query
    if (redirectUrl && /http/.test(decodeURIComponent(redirectUrl))) {
      this.redirectUrl = decodeURIComponent(redirectUrl)
      this.$nextTick(() => {
        this.$refs.fbtOpenWxMiniProgram.init()
      })
    } else {
      Toast('链接出错啦')
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
