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组件将其包起来导致的问题,加上之后正式环境样式问题恢复。