UNPKG

element-nice-ui

Version:

A Component Library for Vue.js.

64 lines (63 loc) 1.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _util = require("element-nice-ui/src/utils/util"); /** * Show migrating guide in browser console. * * Usage: * import Migrating from 'element-nice-ui/src/mixins/migrating'; * * mixins: [Migrating] * * add getMigratingConfig method for your component. * getMigratingConfig() { * return { * props: { * 'allow-no-selection': 'allow-no-selection is removed.', * 'selection-mode': 'selection-mode is removed.' * }, * events: { * selectionchange: 'selectionchange is renamed to selection-change.' * } * }; * }, */ var _default = exports.default = { mounted() { if (process.env.NODE_ENV === 'production') return; if (!this.$vnode) return; const { props = {}, events = {} } = this.getMigratingConfig(); const { data, componentOptions } = this.$vnode; const definedProps = data.attrs || {}; const definedEvents = componentOptions.listeners || {}; for (let propName in definedProps) { propName = (0, _util.kebabCase)(propName); // compatible with camel case if (props[propName]) { console.warn("[Element Migrating][".concat(this.$options.name, "][Attribute]: ").concat(props[propName])); } } for (let eventName in definedEvents) { eventName = (0, _util.kebabCase)(eventName); // compatible with camel case if (events[eventName]) { console.warn("[Element Migrating][".concat(this.$options.name, "][Event]: ").concat(events[eventName])); } } }, methods: { getMigratingConfig() { return { props: {}, events: {} }; } } };