element-plus
Version:
A Component Library for Vue 3
32 lines (31 loc) • 1 kB
JavaScript
import { getCurrentInstance, onMounted } from 'vue';
import { debugWarn } from 'element-plus/es/utils/error';
import { kebabCase } from 'element-plus/es/utils/util';
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) {
propName = kebabCase(propName);
if (props[propName]) {
debugWarn('Element Migrating', `[${instance.proxy.$options.name}][Attribute]: ${props[propName]}`);
}
}
});
const getMigratingConfig = function () {
return {
props: {},
events: {},
};
};
return {
getMigratingConfig,
};
};
export default useMigrating;