1
// Mixins
2
import Colorable from '../colorable'
3

4
// Utilities
5
import mixins from '../../util/mixins'
6
import { kebabCase } from '../../util/helpers'
7

8
// Types
9
import { VNodeChildren } from 'vue'
10

11
/* @vue/component */
12
export default mixins(
13
  Colorable
14
).extend({
15
  methods: {
16
    genPickerButton (
17
      prop: string,
18
      value: any,
19
      content: VNodeChildren,
20 1
      readonly = false,
21 1
      staticClass = ''
22 1
    ) {
23 1
      const active = (this as any)[prop] === value
24 1
      const click = (event: Event) => {
25 1
        event.stopPropagation()
26 1
        this.$emit(`update:${kebabCase(prop)}`, value)
27
      }
28

29 1
      return this.$createElement('div', {
30
        staticClass: `v-picker__title__btn ${staticClass}`.trim(),
31
        class: {
32
          'v-picker__title__btn--active': active,
33
          'v-picker__title__btn--readonly': readonly,
34
        },
35 1
        on: (active || readonly) ? undefined : { click },
36 1
      }, Array.isArray(content) ? content : [content])
37
    },
38
  },
39
})

Read our documentation on viewing source code .

Loading