client-only标签

vue3,h5项目开发,基于nuxt.js问题点学习与总结。

nuxt.js 是在服务端进行渲染页面,而服务器端是没有 window 或 document。

如果渲染的时候需要用到 window 或 document 就会出现 document is not defined 或者 window is not defined

这时候client-only 和 no-ssr 这两个标签都可以 下面提供具体写法

no-ssr

 <no-ssr>
    <mavon-editor :autofocus="false" ref="md" v-model="mdContent" @change="getMdHtml"
                  @imgAdd="uploadContentImg" @imgDel="delContentImg"/>
  </no-ssr>

client-only  

 <client-only>
     <mavon-editor :autofocus="false" ref="md" v-model="mdContent" @change="getMdHtml"
                   @imgAdd="uploadContentImg" @imgDel="delContentImg" />
 </client-only>

client-only 是一种用于保护计算机或者服务器数据的安全措施,通常用于限制对于敏感信息的访问,只允许授权的客户端访问这些数据。

关于DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method.at Object.appendChild的报错。

新增消息通知样式时没有使用clietonly组件将其包起来导致的问题,加上之后正式环境样式问题恢复。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值