@@ -431,7 +431,10 @@ export class VueElement
431
431
const exposed = this . _instance && this . _instance . exposed
432
432
if ( ! exposed ) return
433
433
for ( const key in exposed ) {
434
- if ( ! hasOwn ( this , key ) ) {
434
+ const hasInstanceProperty = hasOwn ( this , key )
435
+ const hasOwnPrototypeProperty = hasOwn ( this . constructor . prototype , key )
436
+
437
+ if ( ! hasInstanceProperty && ! hasOwnPrototypeProperty ) {
435
438
// exposed properties are readonly
436
439
Object . defineProperty ( this , key , {
437
440
// unwrap ref to be consistent with public instance behavior
@@ -460,23 +463,12 @@ export class VueElement
460
463
}
461
464
}
462
465
463
- // defining getter/setters on prototype to allow subclass overrides
466
+ // defining getter/setters to support property access
464
467
for ( const key of declaredPropKeys . map ( camelize ) ) {
465
- // Always define the Vue property on the current prototype, but check if a parent
466
- // class in the prototype chain already has the property defined by a subclass.
467
- // This ensures super.property calls work while allowing subclass overrides.
468
+ // Check if a subclass has already defined this property
468
469
const hasSubclassOverride = this . constructor . prototype . hasOwnProperty ( key )
469
470
470
- if ( ! hasSubclassOverride ) {
471
- Object . defineProperty ( this . constructor . prototype , key , {
472
- get ( ) {
473
- return this . _getProp ( key )
474
- } ,
475
- set ( val ) {
476
- this . _setProp ( key , val , true , true )
477
- } ,
478
- } )
479
- } else {
471
+ if ( hasSubclassOverride ) {
480
472
const parentPrototype = Object . getPrototypeOf (
481
473
this . constructor . prototype ,
482
474
)
@@ -494,6 +486,15 @@ export class VueElement
494
486
} ,
495
487
} )
496
488
}
489
+ } else {
490
+ Object . defineProperty ( this , key , {
491
+ get ( ) {
492
+ return this . _getProp ( key )
493
+ } ,
494
+ set ( val ) {
495
+ this . _setProp ( key , val , true , true )
496
+ } ,
497
+ } )
497
498
}
498
499
}
499
500
}
@@ -506,6 +507,7 @@ export class VueElement
506
507
if ( has && this . _numberProps && this . _numberProps [ camelKey ] ) {
507
508
value = toNumber ( value )
508
509
}
510
+
509
511
this . _setProp ( camelKey , value , false , true )
510
512
}
511
513
0 commit comments