<template>
  <div class="weui_panel weui_panel_access">
    <div
      v-if="header && header.title"
      class="weui_panel_hd"
      @click="$emit('on-click-header')"
    >
      {{ header.title }}
    </div>
    <slot name="header" />
    <div class="weui_panel_bd">
      <div class="vux-card-content">
        <slot name="content" />
      </div>
    </div>
    <a
      v-if="footer && footer.title"
      class="weui_panel_ft"
      href="javascript:"
      @click="onClickFooter"
    >
      {{ footer.title }}
    </a>
    <slot name="footer" />
  </div>
</template>

<script>
import { go } from '../../libs/router'

export default {
  props: {
    header: Object,
    footer: Object
  },
  methods: {
    onClickFooter () {
      this.footer.link && go(this.footer.link, this.$router)
      this.$emit('on-click-footer')
    }
  }
}
</script>
