File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ export function asVmProperty(
39
39
// expose binding to Vue Devtool as a data property
40
40
// delay this until state has been resolved to prevent repeated works
41
41
vm . $nextTick ( ( ) => {
42
+ if ( Object . keys ( vm . _data ) . indexOf ( propName ) !== - 1 ) {
43
+ return
44
+ }
42
45
if ( isRef ( propValue ) ) {
43
46
proxy ( vm . _data , propName , {
44
47
get : ( ) => propValue . value ,
Original file line number Diff line number Diff line change @@ -942,6 +942,34 @@ describe('setup', () => {
942
942
expect ( vm . $el . textContent ) . toBe ( '1' )
943
943
} )
944
944
945
+ // #679 html text change
946
+ it ( 'should id not change when msg changed in development' , async ( ) => {
947
+ global . __DEV__ = true
948
+ const vm = new Vue ( {
949
+ template : '<div>{{ id }} {{ msg }}<button @click="change"/></div>' ,
950
+ setup ( ) {
951
+ return { id : 42 }
952
+ } ,
953
+ data ( ) {
954
+ return {
955
+ id : 1 ,
956
+ msg : 'abc' ,
957
+ }
958
+ } ,
959
+ methods : {
960
+ change ( ) {
961
+ this . msg = this . msg + this . id
962
+ } ,
963
+ } ,
964
+ } ) . $mount ( )
965
+
966
+ await nextTick ( )
967
+ expect ( vm . $el . textContent ) . toBe ( '1 abc' )
968
+ await vm . $el . querySelector ( 'button' ) . click ( )
969
+ await nextTick ( )
970
+ expect ( vm . $el . textContent ) . toBe ( '1 abc1' )
971
+ } )
972
+
945
973
// #683 #603 #580
946
974
it ( 'should update directly when adding attributes to a reactive object' , async ( ) => {
947
975
const vm = new Vue ( {
You can’t perform that action at this time.
0 commit comments