File tree Expand file tree Collapse file tree 2 files changed +163
-65
lines changed Expand file tree Collapse file tree 2 files changed +163
-65
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ async function showUserModal(id: number) {
25
25
params : { id : '' + id } ,
26
26
state : { backgroundView } ,
27
27
} )
28
+ const newState = {
29
+ ...window . history . state ,
30
+ backgroundView,
31
+ }
32
+ window . history . ___replaceState ( newState , '' )
28
33
}
29
34
30
35
function closeUserModal ( ) {
@@ -64,20 +69,23 @@ const Home = defineComponent({
64
69
65
70
const userId = computed ( ( ) => route . params . id )
66
71
67
- watchEffect ( ( ) => {
68
- const el = modal . value
69
- if ( ! el ) return
70
-
71
- const show = historyState . value . backgroundView
72
- console . log ( 'show modal?' , show )
73
- if ( show ) {
74
- if ( 'show' in el ) el . show ( )
75
- else el . setAttribute ( 'open' , '' )
76
- } else {
77
- if ( 'close' in el ) el . close ( )
78
- else el . removeAttribute ( 'open' )
79
- }
80
- } )
72
+ watchEffect (
73
+ ( ) => {
74
+ const el = modal . value
75
+ if ( ! el ) return
76
+
77
+ const show = historyState . value . backgroundView
78
+ console . log ( 'show modal?' , show )
79
+ if ( show ) {
80
+ if ( 'show' in el ) el . show ( )
81
+ else el . setAttribute ( 'open' , '' )
82
+ } else {
83
+ if ( 'close' in el ) el . close ( )
84
+ else el . removeAttribute ( 'open' )
85
+ }
86
+ } ,
87
+ { flush : 'post' }
88
+ )
81
89
82
90
return {
83
91
modal,
You can’t perform that action at this time.
0 commit comments