您当前的位置: 首页 > 

彭世瑜

暂无认证

  • 3浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Nuxt.js打包后报错DOMException: Failed to execute appendChild on Node

彭世瑜 发布时间:2020-06-10 11:45:35 ,浏览量:3

报错问题

Nuxt.js打包后报错

DOMException: Failed to execute 'appendChild' on 'Node': 
This node type does not support this method.

开发环境下报错

Mismatching childNodes vs. VNodes:
解决

1、template中可以限制只在客户端渲染

// version >= 2.9.0


// version < 2.9.0

参考

  1. Failed to execute ‘appendChild’ on ‘Node’: This node type does not support this method.
  2. https://nuxtjs.org/api/components-client-only/

2、script中可以使用客户端、服务端判断

if(process.client){
    console.log('client')
}

if(process.server){
    console.log('server')
}

参考 Window 或 Document 对象未定义

关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.1366s