<template>
  <div class="ttyf-container">
    <div v-html="bannerContent"></div>
  </div>
</template>

<script>
import { getBannerDetail } from './api'
import { Toast } from 'vant'

export default {
  name: 'index',
  props: {
    id: {
      type: [String, Number],
      default: ''
    }
  },
  data () {
    return {
      bannerContent: ''
    }
  },
  created () {
    this.fetchBannerDetail()
  },
  async mounted () {
    await this.$nextTick()
    this.$refreshTitle('贷款')
  },
  methods: {
    // 获取用户分享权限
    fetchBannerDetail () {
      getBannerDetail(this.id).then(res => {
        if (res.status) {
          const { bannerContent } = res.data
          this.bannerContent = bannerContent
        } else {
          Toast(res.msg)
        }
      }).catch(err => {
        Toast(err)
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
