File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export function useProps<T>(currentInstance = getCurrentInstance()): T {
19
19
20
20
const updateProps = computed ( ( ) => {
21
21
const attrs = { } as Record < string , any >
22
- const $attrs = currentInstance ! . proxy ? .$attrs
22
+ const $attrs = isVue2 ? currentInstance ?. $attrs : currentInstance ?. proxy . $attrs
23
23
if ( $attrs ) {
24
24
for ( const attr in $attrs ) {
25
25
// make a backup copy of attrs in props format
@@ -29,12 +29,12 @@ export function useProps<T>(currentInstance = getCurrentInstance()): T {
29
29
30
30
return {
31
31
...attrs ,
32
- ...( isVue2 ? ( currentInstance ! . proxy as any ) ?. _props : currentInstance ?. props )
32
+ ...( isVue2 ? currentInstance ?. _props : currentInstance ?. props )
33
33
}
34
34
} )
35
35
36
36
if ( isVue2 ) {
37
- const set = ( currentInstance ?. proxy as any ) . $set
37
+ const set = ( currentInstance as any ) . $set
38
38
watchEffect (
39
39
( ) => {
40
40
const updatePropsValue = updateProps . value
Original file line number Diff line number Diff line change 1
1
import type { VNode } from 'vue-module-demi'
2
2
import { isVue2 } from '../version'
3
3
import type { ComponentInternalInstance } from '../types'
4
+ import { getCurrentInstance } from '../composables/utils'
4
5
5
6
export * from './children'
6
7
export * from './props'
7
8
export * from './types'
8
9
9
10
export function resolveVNode < T extends VNode = VNode > (
10
- instance : ComponentInternalInstance | null
11
+ instance : ComponentInternalInstance | null = getCurrentInstance ( )
11
12
) : T | null | undefined {
12
- return isVue2 ? ( instance ?. proxy as any ) ?. $vnode : instance ?. vnode
13
+ return isVue2 ? ( instance as any ) ?. $vnode : instance ?. vnode
13
14
}
You can’t perform that action at this time.
0 commit comments