wip: render function compat

This commit is contained in:
Evan You
2021-04-09 18:52:14 -04:00
parent 457a56e331
commit f05d6dfd98
20 changed files with 419 additions and 87 deletions

View File

@@ -54,6 +54,9 @@ import { CompilerOptions } from '@vue/compiler-core'
import { markAttrsAccessed } from './componentRenderUtils'
import { currentRenderingInstance } from './componentRenderContext'
import { startMeasure, endMeasure } from './profiling'
import { isCompatEnabled } from './compat/compatConfig'
import { DeprecationTypes, warnDeprecation } from './compat/deprecations'
import { compatH } from './compat/renderFn'
export type Data = Record<string, unknown>
@@ -681,6 +684,18 @@ export function finishComponentSetup(
) {
const Component = instance.type as ComponentOptions
if (
__COMPAT__ &&
Component.render &&
isCompatEnabled(DeprecationTypes.RENDER_FUNCTION)
) {
warnDeprecation(DeprecationTypes.RENDER_FUNCTION)
const originalRender = Component.render
Component.render = function compatRender() {
return originalRender.call(this, compatH)
}
}
// template / render function normalization
if (__NODE_JS__ && isSSR) {
// 1. the render function may already exist, returned by `setup`