bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
30 lines (26 loc) • 567 B
JavaScript
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 }
}