mirror of https://github.com/vuejs/core.git
parent
f2c1412e46
commit
83661264a4
|
@ -36,8 +36,7 @@ import {
|
||||||
legacyresolveScopedSlots,
|
legacyresolveScopedSlots,
|
||||||
} from './renderHelpers'
|
} from './renderHelpers'
|
||||||
import { resolveFilter } from '../helpers/resolveAssets'
|
import { resolveFilter } from '../helpers/resolveAssets'
|
||||||
import type { InternalSlots, Slots } from '../componentSlots'
|
import type { Slots } from '../componentSlots'
|
||||||
import type { ContextualRenderFn } from '../componentRenderContext'
|
|
||||||
import { resolveMergedOptions } from '../componentOptions'
|
import { resolveMergedOptions } from '../componentOptions'
|
||||||
|
|
||||||
export type LegacyPublicInstance = ComponentPublicInstance &
|
export type LegacyPublicInstance = ComponentPublicInstance &
|
||||||
|
@ -106,14 +105,7 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
|
||||||
|
|
||||||
$scopedSlots: i => {
|
$scopedSlots: i => {
|
||||||
assertCompatEnabled(DeprecationTypes.INSTANCE_SCOPED_SLOTS, i)
|
assertCompatEnabled(DeprecationTypes.INSTANCE_SCOPED_SLOTS, i)
|
||||||
const res: InternalSlots = {}
|
return __DEV__ ? shallowReadonly(i.slots) : i.slots
|
||||||
for (const key in i.slots) {
|
|
||||||
const fn = i.slots[key]!
|
|
||||||
if (!(fn as ContextualRenderFn)._ns /* non-scoped slot */) {
|
|
||||||
res[key] = fn
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
},
|
},
|
||||||
|
|
||||||
$on: i => on.bind(null, i),
|
$on: i => on.bind(null, i),
|
||||||
|
|
|
@ -284,7 +284,7 @@ describe('INSTANCE_SCOPED_SLOTS', () => {
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should not include legacy slot usage in $scopedSlots', () => {
|
test('should include legacy slot usage in $scopedSlots', () => {
|
||||||
let normalSlots: Slots
|
let normalSlots: Slots
|
||||||
let scopedSlots: Slots
|
let scopedSlots: Slots
|
||||||
new Vue({
|
new Vue({
|
||||||
|
@ -301,7 +301,7 @@ describe('INSTANCE_SCOPED_SLOTS', () => {
|
||||||
}).$mount()
|
}).$mount()
|
||||||
|
|
||||||
expect('default' in normalSlots!).toBe(true)
|
expect('default' in normalSlots!).toBe(true)
|
||||||
expect('default' in scopedSlots!).toBe(false)
|
expect('default' in scopedSlots!).toBe(true)
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
deprecationData[DeprecationTypes.INSTANCE_SCOPED_SLOTS].message,
|
deprecationData[DeprecationTypes.INSTANCE_SCOPED_SLOTS].message,
|
||||||
|
|
Loading…
Reference in New Issue