1
// Components
2
import VExpansionPanel from './VExpansionPanel'
3 1
import { VExpandTransition } from '../transitions'
4

5
// Mixins
6 1
import Bootable from '../../mixins/bootable'
7 1
import Colorable from '../../mixins/colorable'
8 1
import { inject as RegistrableInject } from '../../mixins/registrable'
9

10
// Utilities
11 1
import { getSlot } from '../../util/helpers'
12 1
import mixins, { ExtractVue } from '../../util/mixins'
13

14
// Types
15
import Vue, { VNode, VueConstructor } from 'vue'
16

17 1
const baseMixins = mixins(
18
  Bootable,
19
  Colorable,
20
  RegistrableInject<'expansionPanel', VueConstructor<Vue>>('expansionPanel', 'v-expansion-panel-content', 'v-expansion-panel')
21
)
22

23
interface options extends ExtractVue<typeof baseMixins> {
24
  expansionPanel: InstanceType<typeof VExpansionPanel>
25
}
26

27
/* @vue/component */
28 1
export default baseMixins.extend<options>().extend({
29
  name: 'v-expansion-panel-content',
30

31
  computed: {
32 1
    isActive (): boolean {
33 1
      return this.expansionPanel.isActive
34
    },
35
  },
36

37 1
  created () {
38 1
    this.expansionPanel.registerContent(this)
39
  },
40

41 1
  beforeDestroy () {
42 1
    this.expansionPanel.unregisterContent()
43
  },
44

45 1
  render (h): VNode {
46 1
    return h(VExpandTransition, this.showLazyContent(() => [
47
      h('div', this.setBackgroundColor(this.color, {
48
        staticClass: 'v-expansion-panel-content',
49
        directives: [{
50
          name: 'show',
51
          value: this.isActive,
52
        }],
53
      }), [
54
        h('div', { class: 'v-expansion-panel-content__wrap' }, getSlot(this)),
55
      ]),
56
    ]))
57
  },
58
})

Read our documentation on viewing source code .

Loading