UNPKG

v-calendar

Version:

A clean and extendable plugin for building simple attributed calendars in Vue.js.

20 lines (18 loc) 570 B
import { get, has, isObject, defaultsDeep } from '@/utils/_'; export const propOrDefaultMixin = { methods: { propOrDefault(prop, defaultPath, strategy) { return this.passedProp(prop, get(this.$defaults, defaultPath), strategy); }, passedProp(prop, fallback, strategy) { if (has(this.$options.propsData, prop)) { const propValue = this[prop]; if (isObject(propValue) && strategy === 'merge') { return defaultsDeep(propValue, fallback); } return propValue; } return fallback; }, }, };