Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject devtools hook on iframe #498

Open
elonehoo opened this issue Jul 1, 2024 · 7 comments
Open

Inject devtools hook on iframe #498

elonehoo opened this issue Jul 1, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@elonehoo
Copy link

elonehoo commented Jul 1, 2024

in my Chrome old version devtools, colud debug write component, but this is not new version.

old devtools

  • old version 6.6.3 link
image

new devtools

image
@alexzhang1030
Copy link
Member

alexzhang1030 commented Jul 1, 2024

Multiple app issue /cc @webfansplz

@alexzhang1030 alexzhang1030 added the bug Something isn't working label Jul 1, 2024
@webfansplz
Copy link
Member

We're missing the iframe injection case (See:https://github.com/vuejs/devtools/blob/main/packages/app-backend-core/src/hook.ts#L42

After a discussion with @elonehoo, he will try to support this case.

@elonehoo
Copy link
Author

elonehoo commented Jul 1, 2024

🙌 let me handle it!!!!!!!!!!!!!!!!

@alexzhang1030 alexzhang1030 changed the title in play.vuejs.org not way debug write component Iframe injection devtools hook Jul 1, 2024
@alexzhang1030 alexzhang1030 changed the title Iframe injection devtools hook Inject devtools hook Jul 1, 2024
@alexzhang1030 alexzhang1030 changed the title Inject devtools hook Inject devtools hook on iframe Jul 1, 2024
@alexzhang1030 alexzhang1030 added enhancement New feature or request and removed bug Something isn't working labels Jul 1, 2024
@alexzhang1030
Copy link
Member

A playground can be:

// main.ts
const app3 = createApp(Iframe)
app3.mount('#app3')
<script setup lang="ts">
import Srcdoc from './srcdoc.html?raw'
</script>

<template>
  <div class="m-auto mt-5 h-30 w-60 flex flex-col items-center justify-center rounded bg-[#363636]">
    <iframe
      sandbox="allow-forms allow-modals allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation-by-user-activation"
      :srcdoc="Srcdoc"
    />
  </div>
</template>
<html>
  <head>
    <script type="importmap">
      {
        "imports": {
          "vue": "https://play.vuejs.org/vue.runtime.esm-browser.js"
        }
      }
    </script>
  </head>
  <body>
    <div id="app"></div>
    <script type="module">
      import { createApp, h, ref } from 'vue'

      const app = createApp({
        setup() {
          const counter = ref(0)

          return () =>
            h(
              'div',
              {
                style: {
                  color: 'white',
                  display: 'flex',
                  'flex-wrap': 'wrap',
                  'justify-content': 'center',
                  'align-items': 'center',
                  height: '100vh',
                },
              },
              h('h1', { style: { width: '100%' } }, 'App3 in iframe'),
              h('count', `${counter.value}`),
              h('div', h('button', { onClick: () => counter.value++ }, '++')),
            )
        },
      }).mount('#app')
    </script>
  </body>
</html>

@elonehoo
Copy link
Author

elonehoo commented Jul 1, 2024

wait..... this is so cool

@weeks6
Copy link

weeks6 commented Nov 5, 2024

@elonehoo any progress?

@LukerSpringtree
Copy link
Contributor

any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants