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

nuxt3使用vconsole的正确姿势 #631

Open
Keekuun opened this issue Jun 27, 2023 · 2 comments
Open

nuxt3使用vconsole的正确姿势 #631

Keekuun opened this issue Jun 27, 2023 · 2 comments

Comments

@Keekuun
Copy link

Keekuun commented Jun 27, 2023

nuxt3使用vconsole的正确姿势:

app: {
    head: {
      script: [
         {
           src: '//unpkg.com/vconsole@latest/dist/vconsole.min.js',
           type: 'text/javascript',
         },
      ],
    },

初始化:

if (process.client) {
  process.dev && window.VConsole && new window.VConsole()
}

上述初始化方式虽然可以在页面引入vconsole,但是无法正确捕获到请求。

将初始化方式放在config文件中:

  app: {
    head: {
      script: [
         {
          src: '//unpkg.com/vconsole@latest/dist/vconsole.min.js',
           type: 'text/javascript',
         },
         { innerHTML: 'new VConsole()' },
      ],
    },
  },

使用eruda也是同样的引入方式

liriliri/eruda#303

@Keekuun
Copy link
Author

Keekuun commented Jun 27, 2023

希望可以帮助更多开发者少踩坑

@AnGaoLang
Copy link

hello你知道为啥么。

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

No branches or pull requests

2 participants