【问题标题】:"Maximum call stack size exceeded" in Nuxt/ContentNuxt/Content 中的“超出最大调用堆栈大小”
【发布时间】:2021-11-23 15:00:43
【问题描述】:

我尝试设置一个非常简单的 nuxt 内容示例,但即便如此,我在打开 localhost:port/ 时遇到了 Maximum call stack size exceeded 错误

pages/_slag.vue:

<template>
    <nuxt-content :document="doc" />
</template>

<script>
export default {

    async asyncData({ $content, params }) {
        const doc = await $content(params.slug || 'index');

        return { doc }
    }
    
};
</script>

内容/index.md:

# Hello @nuxtjs/content!

Super fast HMR!

nuxt-config.js:

export default {
  vue: {
    config: {
      // https://vue-loader.vuejs.org/options.html#cachedirectory-cacheidentifier
    },
  },
  target: 'static',    
  
  buildModules: [
  ],
  modules: [
    '@nuxt/content'
  ],
  content: {
  },   
  build: {
  },
  generate: {
    concurrency: 2000,
  }
}

package.json:

"dependencies": {
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/tailwindcss": "^4.2.1",
    "@nuxt/content": "1.14.0",
    "core-js": "^3.18.0",
    "nuxt": "^2.15.8",
    "vue-inline-svg": "^2.0.0"
},
"devDependencies": {
    "@vue/test-utils": "^1.2.1",
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "^27.0.5",
    "jest": "^27.0.5",
    "postcss": "^8.3.5",
    "vue-jest": "^3.0.4"
},
"optionalDependencies": {
    "fsevents": "^2.3.2"
}

我做错了什么?

【问题讨论】:

    标签: vue.js nuxt.js nuxt-content


    【解决方案1】:

    您没有获取您查询的数据。更新您的 $content 如下:$content(params.slug || 'index').fetch()

    【讨论】:

      猜你喜欢
      • 2021-10-13
      • 2021-02-05
      • 2020-11-15
      • 2021-06-04
      • 1970-01-01
      • 2015-10-24
      • 2015-12-29
      • 2017-12-27
      • 2020-12-06
      相关资源
      最近更新 更多