<template>
<div class="card-wrapper">
  <div v-if="!hideTitle" class="card-title" :style="`color:${color}`">
    <img v-if="icon" :src="icon"/>
    <p>{{title}}</p>
    <img v-if="more" :src="more" @click="$store.commit('CHANGE_ISSHOWMORE',true)">
  </div>
  <div class="card-content" :style="contentStyle">
    <slot />
  </div>
</div>
</template>

<script>
export default {
  name: 'Mode3',
  props: {
    icon: {},
    more: {},
    title: {
      type: String,
      default: '标题',
    },
    color: {
      type: String,
    },
    hideTitle: {
      type: Boolean,
      default: false,
    },
  },
  computed: {
    contentStyle() {
      if (!this.hideTitle) return {}
      return {
        'height': '100%',
        'overflow-y': 'hidden',
      }
    }
  },
}
</script>

<style lang="stylus" scoped>
$bg = rgba(150, 135, 5, 0.7)
// $bg = rgba(255, 165, 0, 0.5)
.card-wrapper
  padding 0 !important
  .card-title
    display flex
    align-items center
    justify-content space-between
    color #fff
    font-size 1.4rem
    font-weight bold
    // background $cardBg
    background rgba(255, 165, 0, 0.7)
    margin-bottom 0.5rem
    height 3rem
    padding 0 1rem
    p
      flex 1
    >img
      width 1.4rem
      margin-right 1rem
      &:last-child
        width 1.8rem
        margin 0
        cursor pointer
  .card-content
    background $bg
    padding 0.8rem 1rem
</style>
