-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* 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.' | ||
* } | ||
* }; | ||
* }, | ||
*/ | ||
export default { | ||
mounted() { | ||
if (process.env.NODE_ENV === 'production') return; | ||
const { props, events } = this.getMigratingConfig(); | ||
const { data, componentOptions } = this.$vnode; | ||
const definedProps = data.attrs || {}; | ||
const definedEvents = componentOptions.listeners || {}; | ||
|
||
for (let propName in definedProps) { | ||
if (definedProps.hasOwnProperty(propName) && props[propName]) { | ||
console.warn(`[Element Migrating][Attribute]: ${props[propName]}`); | ||
} | ||
} | ||
|
||
for (let eventName in definedEvents) { | ||
if (definedEvents.hasOwnProperty(eventName) && events[eventName]) { | ||
console.warn(`[Element Migrating][Event]: ${events[eventName]}`); | ||
} | ||
} | ||
}, | ||
methods: { | ||
getMigratingConfig() { | ||
return { | ||
props: {}, | ||
events: {} | ||
}; | ||
} | ||
} | ||
}; |