2021-04-22 10:04:26 +08:00
|
|
|
import { isOn } from '@vue/shared'
|
|
|
|
import { ComponentInternalInstance } from '../component'
|
|
|
|
import { DeprecationTypes, isCompatEnabled } from './compatConfig'
|
|
|
|
|
|
|
|
export function shouldSkipAttr(
|
|
|
|
key: string,
|
2021-04-23 05:30:54 +08:00
|
|
|
value: any,
|
2021-04-22 10:04:26 +08:00
|
|
|
instance: ComponentInternalInstance
|
|
|
|
): boolean {
|
|
|
|
if (
|
|
|
|
(key === 'class' || key === 'style') &&
|
|
|
|
isCompatEnabled(DeprecationTypes.INSTANCE_ATTRS_CLASS_STYLE, instance)
|
|
|
|
) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
isOn(key) &&
|
|
|
|
isCompatEnabled(DeprecationTypes.INSTANCE_LISTENERS, instance)
|
|
|
|
) {
|
|
|
|
return true
|
|
|
|
}
|
2021-04-23 05:30:54 +08:00
|
|
|
// vue-router
|
|
|
|
if (key.startsWith('routerView') || key === 'registerRouteInstance') {
|
|
|
|
return true
|
|
|
|
}
|
2021-04-22 10:04:26 +08:00
|
|
|
return false
|
|
|
|
}
|