mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 01:11:25 +08:00
2985a71751
Co-authored-by: winerlu <winerlu@tencent.com> Co-authored-by: zazzaz <izazzaz@hotmail.com>
34 lines
863 B
TypeScript
34 lines
863 B
TypeScript
import { kebabCase } from '@element-plus/utils/util'
|
|
import { onMounted, getCurrentInstance } from 'vue'
|
|
|
|
const useMigrating = function () {
|
|
onMounted(() => {
|
|
const instance = getCurrentInstance()
|
|
if (process.env.NODE_ENV === 'production') return
|
|
if (!instance.vnode) return
|
|
const { props = {} } = getMigratingConfig()
|
|
const { data } = instance
|
|
const definedProps = data.attrs || {}
|
|
|
|
for (let propName in definedProps as any) {
|
|
propName = kebabCase(propName) // compatible with camel case
|
|
if (props[propName]) {
|
|
console.warn(
|
|
`[Element Migrating][${this.$options.name}][Attribute]: ${props[propName]}`,
|
|
)
|
|
}
|
|
}
|
|
})
|
|
const getMigratingConfig = function () {
|
|
return {
|
|
props: {},
|
|
events: {},
|
|
}
|
|
}
|
|
return {
|
|
getMigratingConfig,
|
|
}
|
|
}
|
|
|
|
export default useMigrating
|