wip: vm._data for vuex compat

This commit is contained in:
Evan You 2021-05-04 11:11:43 -04:00
parent a9d0de50ee
commit 4d62670d3d

View File

@ -117,9 +117,11 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
/* istanbul ignore if */ /* istanbul ignore if */
if (isCompatEnabled(DeprecationTypes.PRIVATE_APIS, null)) { if (isCompatEnabled(DeprecationTypes.PRIVATE_APIS, null)) {
extend(map, { extend(map, {
// needed by many libs / render fns
$vnode: i => i.vnode, $vnode: i => i.vnode,
// inject addtional properties into $options for compat // inject addtional properties into $options for compat
// e.g. vuex needs this.$options.parent
$options: i => { $options: i => {
let res = resolveMergedOptions(i) let res = resolveMergedOptions(i)
if (res === i.type) res = i.type.__merged = extend({}, res) if (res === i.type) res = i.type.__merged = extend({}, res)
@ -128,6 +130,9 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
return res return res
}, },
// internal data access... (vuex uses this)
_data: i => i.data,
// v2 render helpers // v2 render helpers
$createElement: () => compatH, $createElement: () => compatH,
_self: i => i.proxy, _self: i => i.proxy,