wip: root mount api compat

This commit is contained in:
Evan You
2021-04-05 11:54:35 -04:00
parent 24850a99c6
commit e2d6ff845b
7 changed files with 228 additions and 30 deletions

View File

@@ -11,7 +11,9 @@ import {
isGloballyWhitelisted,
NOOP,
extend,
isString
isString,
warnDeprecation,
DeprecationTypes
} from '@vue/shared'
import {
ReactiveEffect,
@@ -233,6 +235,25 @@ const publicPropertiesMap: PublicPropertiesMap = extend(Object.create(null), {
$watch: i => (__FEATURE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP)
} as PublicPropertiesMap)
if (__COMPAT__) {
extend(publicPropertiesMap, {
$mount: i => {
if (__DEV__) {
warnDeprecation(DeprecationTypes.$MOUNT)
}
// root mount override from apiCreateApp.ts
return i.ctx._compat_mount || NOOP
},
$destroy: i => {
if (__DEV__) {
warnDeprecation(DeprecationTypes.$DESTROY)
}
// root destroy override from apiCreateApp.ts
return i.ctx._compat_destroy || NOOP
}
} as PublicPropertiesMap)
}
const enum AccessTypes {
SETUP,
DATA,