mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-11 11:39:43 +08:00
36 lines
935 B
TypeScript
36 lines
935 B
TypeScript
import { debugWarn } from '@element-plus/utils/error'
|
|
import { kebabCase } from '@element-plus/utils/util'
|
|
import { getCurrentInstance, onMounted } 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]) {
|
|
debugWarn(
|
|
'Element Migrating',
|
|
`[${instance.proxy.$options.name}][Attribute]: ${props[propName]}`
|
|
)
|
|
}
|
|
}
|
|
})
|
|
const getMigratingConfig = function () {
|
|
return {
|
|
props: {},
|
|
events: {},
|
|
}
|
|
}
|
|
return {
|
|
getMigratingConfig,
|
|
}
|
|
}
|
|
|
|
export default useMigrating
|