
获得徽章 11
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇沸点
#每天一个知识点# nuxt3使用vconsole的正确姿势:
``` nuxt.config.ts
app: {
head: {
script: [
{
src: '//unpkg.com/vconsole@latest/dist/vconsole.min.js',
type: 'text/javascript',
},
],
},
```
初始化:
```app.vue
if (process.client) {
process.dev && window.VConsole && new window.VConsole()
}
```
上述初始化方式虽然可以在页面引入vconsole,但是无法正确捕获到请求。
将初始化方式放在config文件中:
``nuxt.config.ts
app: {
head: {
script: [
{
src: '//unpkg.com/vconsole@latest/dist/vconsole.min.js',
type: 'text/javascript',
},
{ innerHTML: 'new VConsole()' },
],
},
},
```
使用eruda也是同样的引入方式
github.com
``` nuxt.config.ts
app: {
head: {
script: [
{
src: '//unpkg.com/vconsole@latest/dist/vconsole.min.js',
type: 'text/javascript',
},
],
},
```
初始化:
```app.vue
if (process.client) {
process.dev && window.VConsole && new window.VConsole()
}
```
上述初始化方式虽然可以在页面引入vconsole,但是无法正确捕获到请求。
将初始化方式放在config文件中:
``nuxt.config.ts
app: {
head: {
script: [
{
src: '//unpkg.com/vconsole@latest/dist/vconsole.min.js',
type: 'text/javascript',
},
{ innerHTML: 'new VConsole()' },
],
},
},
```
使用eruda也是同样的引入方式
展开
4
3
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章