mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-07-15 22:38:04 +08:00
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
/**
|
|
* Show migrating guide in browser console.
|
|
*
|
|
* Usage:
|
|
* import Migrating from 'element-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.'
|
|
* }
|
|
* };
|
|
* },
|
|
*/
|
|
exports.default = {
|
|
mounted: function mounted() {
|
|
if (process.env.NODE_ENV === 'production') return;
|
|
if (!this.$vnode) return;
|
|
|
|
var _getMigratingConfig = this.getMigratingConfig(),
|
|
props = _getMigratingConfig.props,
|
|
events = _getMigratingConfig.events;
|
|
|
|
var _$vnode = this.$vnode,
|
|
data = _$vnode.data,
|
|
componentOptions = _$vnode.componentOptions;
|
|
|
|
var definedProps = data.attrs || {};
|
|
var definedEvents = componentOptions.listeners || {};
|
|
|
|
for (var propName in definedProps) {
|
|
if (definedProps.hasOwnProperty(propName) && props[propName]) {
|
|
console.warn('[Element Migrating][Attribute]: ' + props[propName]);
|
|
}
|
|
}
|
|
|
|
for (var eventName in definedEvents) {
|
|
if (definedEvents.hasOwnProperty(eventName) && events[eventName]) {
|
|
console.warn('[Element Migrating][Event]: ' + events[eventName]);
|
|
}
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
getMigratingConfig: function getMigratingConfig() {
|
|
return {
|
|
props: {},
|
|
events: {}
|
|
};
|
|
}
|
|
}
|
|
}; |