查看“︁Node.js/nuxt”︁的源代码
来自康健生活
←
Node.js/nuxt
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 引言 == == 参数 == {| class="wikitable" |- | [[/target|target]] || [[/modern|modern]] || [[/axios|axios]] |- | [[/asyncData|asyncData]] || 示例 || 示例 |- | 示例 || 示例 || 示例 |} == 内存 == <blockquote> <syntaxhighlight lang="bash"> npm install heapdump --save-dev </syntaxhighlight></blockquote> {{hc|nuxt.config.js|<syntaxhighlight lang="javascript"> var headpdump = require('heapdump') setInterval(function () { console.log('st headpdump') headpdump.writeSnapshot(function(err, filename) { console.log('dump written to', filename) }) }, 15000)</syntaxhighlight>}} 打开 chrome 浏览器开发者工具 memory 选项卡,点击加载 hepdump。 == 目录结构 == <pre> assets // 用于组织未编译的静态资源如LESS、SASS或JavaScript components // 用于自己编写的Vue组件,比如波动组件、日历组件、分页组件 layouts // 布局目录,用于组织应用的布局组件,不可更改 middleware // 用于存放中间件 pages // 用于存放写的页面,我们主要的工作区域 plugins // 用于存放JavaScript插件的地方 static // 用于存放静态资源文件,比如图片 store // 用于组织应用的Vuex 状态管理 .nuxt // Nuxt自动生成,临时的用于编辑的文件,build .editorconfig // 开发工具格式配置 .eslintrc.js // ESLint的配置文件,用于检查代码格式 .gitignore // 配置git不上传的文件 nuxt.config.json // 用于组织Nuxt.js应用的个性化配置,已覆盖默认配置 package-lock.json // npm自动生成,用于帮助package的统一设置的,yarn也有相同的操作 package.json // npm 包管理配置文件</pre> == 关键词 == {| class="wikitable" |- | [[/传值|传值]] || [[/路由|路由]] || [[/跨域|跨域]] || [[/token|token]] |- | [[/全局变量|全局变量]] || [[/生命周期|生命周期]] || [[/session|session]] |- | 示例 || 示例 || 示例 |} == 调试 == {| class="wikitable" |- | [[/debugger|debugger]] || [[/mockjs|mockjs]] || 示例 |- | 示例 || 示例 || 示例 |- | 示例 || 示例 || 示例 |} == error == * Renderer resources are not loaded! Please check possible console errors and ensure dis *: 配置项有问题 * ENOSPC: System limit for number of file watchers reached, watch *: 系统监听数上限 * error Unable to resolve path to module '@@/pages/search/navmenu.vue' import/no-unresolved *: {{shc|<syntaxhighlight lang="bash"> npm i --save-dev eslint-import-resolver-alias </syntaxhighlight>|$}} *: <syntaxhighlight lang="javascript"> settings: { 'import/resolver': { alias: { map: [ ['@', './'], ['@@', './'], ['~', './'], ['~~', './'], ], } } },</syntaxhighlight> * Duplicate keys detected: '/search'. This may cause an update error. *: key值不唯一 * Error: Avoided redundant navigation to current location: *: 路由重复,<code>this.$router.replace</code> 抛出错误。 *: <syntaxhighlight lang="javascript"> // this.$router.replace('/search?pageView=SearchAll&q=' + this.searchValue) this.$router.push('/search?pageView=SearchAll&q=' + this.searchValue)</syntaxhighlight> *: 或者直接更改文件重写 <code>this.$router.replace</code> 方法。 *: 在 router.js 文件 *: <syntaxhighlight lang="javascript"> /** * @author kangkk * @date 2020/7/15 * @description 禁止 router.replace 方法在路由指向上一次相同地址时抛出 Error: Avoided redundant navigation to current location */ // eslint-disable-next-line no-proto const originalPush = router.__proto__.replace // eslint-disable-next-line no-proto router.__proto__.replace = function replace (location) { return originalPush.call(this, location).catch(err => err) }</syntaxhighlight> * Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. * getaddrinfo ENOTFOUND *: DNS 解析问题,我抛出的是 <code>getaddrinfo ENOTFOUND apiv2.chu***.cn</code> 的错误,只需要在本地 hosts 文件夹里将 <code>apiv2.chu***.cn</code> 的解析地址填入即可。 *: <syntaxhighlight lang="javascript"> 39.***.***.*** apiv2.chu***.cn</syntaxhighlight> *: 这里需要说明的是,因为项目需求,<code>apiv2.chu***.cn</code> 并不是实际的域名,也就是说它只是一个自定义的字段,需要在 DNS 服务器解析。 * [Function (anonymous)] *: 匿名函数
此页面嵌入的页面:
模板:Hc
(
查看源代码
)
模板:Hc/style.css
(
查看源代码
)
模板:Shc
(
查看源代码
)
模板:Shc/style.css
(
查看源代码
)
返回
Node.js/nuxt
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。