UNPKG

vue-class-component

Version:

ES201X/TypeScript class decorator for Vue components

29 lines (28 loc) 779 B
import { Vue } from './vue'; export function Options(options) { return Component => { Component.__vccBase = options; return Component; }; } export function createDecorator(factory) { return (target, key, index) => { const Ctor = typeof target === 'function' ? target : target.constructor; if (!Ctor.__vccDecorators) { Ctor.__vccDecorators = []; } if (typeof index !== 'number') { index = undefined; } Ctor.__vccDecorators.push(options => factory(options, key, index)); }; } export function mixins(...Ctors) { var _a; return _a = class MixedVue extends Vue { }, _a.__vccMixins = Ctors.map(Ctor => Ctor.__vccOpts), _a; }