
SSR
SSR
lllomh
私信邮箱: lllomh@qq.com 网站: https://www.lllomh.com/
展开
-
Nextjs 设置网页meta等
放里面就行 . 在_app.js 中。原创 2025-01-02 06:29:21 · 184 阅读 · 0 评论 -
Nextjs13报错Unhandled Runtime ErrorError: React.Children.only expected to receive a single React elem
报错。原创 2023-11-16 15:50:35 · 437 阅读 · 0 评论 -
Nextjs服务端中存入cookie 全站使用然后跳转getServerSideProps
【代码】Nextjs服务端中存入cookie 全站使用然后跳转getServerSideProps。原创 2024-04-02 12:43:57 · 385 阅读 · 0 评论 -
Nextjs打包类型检查报错ype error: Property ‘card_list‘ does not exist on type(已解决)
这样就行了. 打包类型检查就可以通过, 本篇整合来自 群友:@年轻人不要太年轻。那么在 声明类型的时候 使用。原创 2024-01-03 13:38:24 · 698 阅读 · 0 评论 -
nextjs13 中点击传 dom 给函数写法
传当前的元素 重点是 currentTarget. 如果直接使用 target 会传当前元素里面的元素。nextjs13 中点击传 dom 给函数写法。原创 2023-10-18 17:18:08 · 318 阅读 · 0 评论 -
next build 报错Type error: ‘wid‘ is possibly ‘undefined‘.
当 在 nextjs 中使用jq的时候报错ype error: 'wid' is possibly 'undefined'.15行的 wid 可能是undefined, 这时候给个 初始值就行。原创 2023-10-12 15:37:52 · 466 阅读 · 0 评论 -
关于 useEffect(() => { handlePostRequest(); }, []);执行2次(已解决)
reactStrictMode 设置为 false 就可以了.记得重新run dev。执行2次问题. 这个在开发环境出现的时候,关闭下 next.config.js 中的。原创 2023-10-11 16:39:39 · 476 阅读 · 0 评论 -
设置 301 重定向 muxt asyncData 错误页 404 状态码
这里使用了 redirect 方法来进行重定向,与使用 req.writeHead 方法的效果是一样的,都是返回一个 301 状态码和一个 location 头部指向重定向地址的响应。但是,使用 redirect 方法可以更加简单地实现重定向操作,减少了代码量和复杂度。在这个方法内部,使用了 redirect 方法进行重定向操作,将当前页面重定向到一个指定的 URL。在这里,重定向方式是 301 永久重定向,重定向目标地址为变量 url。设置 301 重定向。原创 2023-05-03 20:01:25 · 687 阅读 · 1 评论 -
Nuxtjs 引入jq的第三方库报错jquery.bgswitcher.js:559 Uncaught ReferenceError: jQuery is not defined方案(已解决)
1,首先改造一下该插件的写法: /plugins/bgswitcher.js。这里我就根据 jQuery.headroom.js 插件为例子。demo 请狠狠的戳这里。原创 2023-08-01 14:27:01 · 551 阅读 · 0 评论 -
next.js报错Error: React.Children.only expected to receive a single React element child.(已解决)
next.js 报错Error: React.Children.only expected to receive a single React element child.这个只要把里面的 Link 标签换 a 就可以了, 效果都一样的, Link标签最后也是会渲染成a标签的原创 2021-11-11 16:20:57 · 1692 阅读 · 0 评论 -
nuxtjs接口多代理转发
如下 proxy: { '/api': { target: 'http://192.168.1.56:8080', // 目标接口域名 changeOrigin: true, // 表示是否跨域 pathRewrite: { '^/api': '', // 把 /api 替换成‘’ } }, '/music': { target: 'http://music.text.com', // 目标接口域名.原创 2021-09-10 16:17:09 · 1345 阅读 · 0 评论 -
nextjs代理转发fetch请求封装
原创 2022-01-01 15:57:24 · 5622 阅读 · 0 评论 -
next.js引入 cookie 报错
引入 cookie 报错写在要用的方法下面就可以了 handleClickSubmit= async ()=>{ const [setCookie] = useCookies(["user"]) let param={ reqName:'P_LOGIN', email:this.state.username, password:this.state.passw..原创 2021-09-07 17:22:55 · 1167 阅读 · 0 评论 -
next.js The old API will be supported in all 16.x releases, but applications using it should migrate
react-dom.development.js:67 Warning: Legacy context API has been detected within a strict-mode tree.The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.Please update the following components:原创 2021-09-06 17:57:29 · 1060 阅读 · 0 评论 -
nuxt.js ssr vuex 实现登录操作刷新数据不丢失
11111原创 2021-09-03 14:15:47 · 1418 阅读 · 0 评论 -
Nuxt.js自定义错误页
在asyncData 有错误的时候会出现这个错误,这个可以自定义吗?可以,完全自定义错误页面不知道是不是官方文档故意不添加此方法,还是他们完全忘记了有这么一回事,此方法是通过issues找到的。项目目录新增app/views/error.html, app 目录与 pages 目录同级。内容可以复制github的官方源码:<!DOCTYPE html><html><head><title><%= messag...原创 2021-07-09 15:44:33 · 2094 阅读 · 0 评论 -
Nuxt.js Unexpected token ‘export‘
这种情况报错如果是知道问价的话,就看文件比如遇到原创 2021-05-28 15:42:48 · 2236 阅读 · 3 评论 -
nuxt 报Though the “loose“ option was set to “false“ in your @babel/preset-env config, it will not(解决)
nuxt 执行报错 :WARN Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties...原创 2021-05-08 14:06:28 · 7104 阅读 · 6 评论 -
Vue Nuxt.js项目启动后可以在局域网内访问的配置方法
1.在当前项目安装依赖npm install --save-dev cross-env2.修改package.json ip为自己电脑的地址 "scripts": { "dev": "cross-env NUXT_HOST=192.168.1.192 NUXT_PORT=3000 nuxt",}原创 2021-04-27 13:32:16 · 1735 阅读 · 0 评论 -
React-next.js组件中[已解决]react异常:Can‘t perform a React state update on an unmounted component
报错如下图:Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.原因:r.原创 2022-07-04 12:10:47 · 792 阅读 · 0 评论 -
React-next.js中获取不到window属性问题ReferenceError: window is not defined
在componentDidMount里面获取即可 componentDidMount() { this.scrolltops() console.log('window.innerHeight', window.innerHeight); } scrolltops=()=> { window.addEventListener('scroll', () => { if(document.原创 2022-09-04 13:50:09 · 3281 阅读 · 0 评论 -
React-next.js中渲染变量的坑报错Error: React.Children.only expected to receive a single React element child.
这个问题再 react 前端渲染的时候是没有问题的,但是在next的项目中会出现:在字段中类型不一样的时候,如果你写的是:会导致报出奇怪的错误,很难定位的那种如图:会直接报前面 setState 的错误,确实让人摸不着头脑。--------分割线------------------------------后来发现,是类型的问题,这render 好像只能渲染字符串的数据:于是乎改成:转为字符串成功,不再报之前的错误了!至此:解决该问题...原创 2020-11-01 17:47:43 · 2359 阅读 · 0 评论