Blame view

node_modules/bootstrap-vue/src/utils/model.js 567 Bytes
4cd4fd28   郭伟龙   feat: 初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { extend } from '../vue'
import { EVENT_NAME_INPUT } from '../constants/events'
import { PROP_TYPE_ANY } from '../constants/props'
import { makeProp } from './props'

export const makeModelMixin = (
  prop,
  {
    type = PROP_TYPE_ANY,
    defaultValue = undefined,
    validator = undefined,
    event = EVENT_NAME_INPUT
  } = {}
) => {
  const props = {
    [prop]: makeProp(type, defaultValue, validator)
  }

  // @vue/component
  const mixin = extend({
    model: {
      prop,
      event
    },
    props
  })

  return { mixin, props, prop, event }
}