1
1
<script setup lang="ts">
2
2
const play = usePlaygroundStore ()
3
+ const preview = usePreviewStore ()
3
4
4
5
const inputUrl = ref <string >(' ' )
5
6
const inner = ref <{ iframe? : HTMLIFrameElement | undefined }>()
6
7
7
8
// auto update inputUrl when location value changed
8
- syncRef (computed (() => play .previewLocation .fullPath ), inputUrl , { direction: ' ltr' })
9
+ syncRef (
10
+ computed (() => preview .location .fullPath ),
11
+ inputUrl ,
12
+ { direction: ' ltr' },
13
+ )
9
14
10
15
function refreshIframe() {
11
- play . updatePreviewUrl ()
12
- if (play . previewUrl && inner .value ?.iframe ) {
13
- inner .value .iframe .src = play . previewUrl
14
- inputUrl .value = play . previewLocation .fullPath
16
+ preview . updateUrl ()
17
+ if (preview . url && inner .value ?.iframe ) {
18
+ inner .value .iframe .src = preview . url
19
+ inputUrl .value = preview . location .fullPath
15
20
}
16
21
}
17
22
25
30
)
26
31
27
32
function navigate() {
28
- play . previewLocation .fullPath = inputUrl .value
29
- play . updatePreviewUrl ()
33
+ preview . location .fullPath = inputUrl .value
34
+ preview . updateUrl ()
30
35
const activeElement = document .activeElement
31
36
if (activeElement instanceof HTMLElement )
32
37
activeElement .blur ()
@@ -50,7 +55,7 @@ function navigate() {
50
55
mx-auto min-w-100 w-full rounded bg-faded px2 text-sm
51
56
border =" base 1 hover:gray-500/30"
52
57
:class =" {
53
- 'pointer-events-none': !play.previewUrl ,
58
+ 'pointer-events-none': !preview.url ,
54
59
}"
55
60
>
56
61
<form w-full @submit.prevent =" navigate" >
@@ -61,7 +66,7 @@ function navigate() {
61
66
</form >
62
67
<div flex =" ~ items-center justify-end" >
63
68
<button
64
- v-if =" play.previewUrl "
69
+ v-if =" preview.url "
65
70
mx1 op-75 hover:op-100
66
71
@click =" refreshIframe"
67
72
>
@@ -85,22 +90,22 @@ function navigate() {
85
90
<div flex =" ~ gap-2 items-center" >
86
91
Vue version:
87
92
<div
88
- v-if =" !play .clientInfo?.versionVue"
93
+ v-if =" !preview .clientInfo?.versionVue"
89
94
i-svg-spinners-90-ring-with-bg
90
95
/>
91
96
<code v-else >
92
- v{{ play .clientInfo.versionVue }}
97
+ v{{ preview .clientInfo.versionVue }}
93
98
</code >
94
99
</div >
95
100
<div i-simple-icons-nuxtdotjs text-xl />
96
101
<div flex =" ~ gap-2 items-center" >
97
102
Nuxt version:
98
103
<div
99
- v-if =" !play .clientInfo?.versionNuxt"
104
+ v-if =" !preview .clientInfo?.versionNuxt"
100
105
i-svg-spinners-90-ring-with-bg
101
106
/>
102
107
<code v-else >
103
- v{{ play .clientInfo.versionNuxt }}
108
+ v{{ preview .clientInfo.versionNuxt }}
104
109
</code >
105
110
</div >
106
111
</div >
0 commit comments