Skip to content

Commit 21d6c7f

Browse files
authored
feat(client): allow to open potential lazy load components in editor (#270)
1 parent 05c0148 commit 21d6c7f

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎client/app/pages/component-lazy-load.vue‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import { useDevtoolsClient } from '@nuxt/devtools-kit/iframe-client'
23
import type { ComponentLazyLoadData, DirectImportInfo } from '../../../src/runtime/lazy-load/schema'
34
import { LAZY_LOAD_ROUTE } from '../utils/routes'
45
@@ -9,6 +10,7 @@ definePageMeta({
910
})
1011
1112
const nuxtApp = useNuxtApp()
13+
const devtoolsClient = useDevtoolsClient()
1214
1315
const entries = computed(() =>
1416
nuxtApp.$lazyLoadHints.value.filter(
@@ -80,10 +82,24 @@ async function dismiss(id: string) {
8082
<span class="text-xs text-neutral-400 ml-1">→ Lazy{{ imp.componentName }}</span>
8183
</td>
8284
<td class="py-2 text-xs text-neutral-500 dark:text-neutral-400 truncate max-w-48">
83-
{{ imp.importSource }}
85+
<button
86+
type="button"
87+
title="open in editor"
88+
class="cursor-pointer text-inherit underline bg-transparent border-0 p-0"
89+
@click="devtoolsClient?.devtools.rpc.openInEditor(imp.importSource)"
90+
>
91+
{{ imp.importSource }}
92+
</button>
8493
</td>
8594
<td class="py-2 text-xs text-neutral-500 dark:text-neutral-400 truncate max-w-48">
86-
{{ imp.importedBy }}
95+
<button
96+
type="button"
97+
title="open in editor"
98+
class="cursor-pointer text-inherit underline bg-transparent border-0 p-0"
99+
@click="devtoolsClient?.devtools.rpc.openInEditor(imp.importedBy)"
100+
>
101+
{{ imp.importedBy }}
102+
</button>
87103
</td>
88104
</tr>
89105
</tbody>

0 commit comments

Comments
 (0)