【问题标题】:I'm having trouble displaying child pages using Gridsome and Directus我在使用 Gridsome 和 Directus 显示子页面时遇到问题
【发布时间】:2020-01-31 19:08:03
【问题描述】:

感谢阅读!

我正在尝试在我的 Gridsome Directus 项目中显示子页面。

我在模板目录中有一个 Shop.vue 模板。

我正在使用 @pienter/gridsome-source-directus 并尝试过 gridsome-source-directus。

下面的代码是我添加的。到目前为止,我在网上找不到任何可以帮助解决问题的内容,而且我在文档中也没有看到任何可以帮助我解决问题的内容。

一些gridsome.config.js

`module.exports = {
    templates: {
        Shop: [
            {
                path: '/shop/:id',
                component: 'templates/Shop.vue'
            }
        ]
    },
    {
        use: '@pienter/gridsome-source-directus',
        options: {
            routes: {
            shop: '/shop/:slug',
        },
    },
    }`
Error: child "path" fails because ["path" is required] at vaidateOptions (C:\wamp64\www\gridsome\node_modules\gridsome\lib\pages\validateOptions.js:20:11) at Pages._normalizeOptions (C:\wamp64\www\gridsome\node_modules\gridsome\lib\pages\pages.js:166:21) at Pages.createPage (C:\wamp64\www\gridsome\node_modules\gridsome\lib\pages\pages.js:83:26) at Object.createPage (C:\wamp64\www\gridsome\node_modules\gridsome\lib\pages\utils.js:33:20) at VueTemplates.createNodePage (C:\wamp64\www\sites\gridsome\node_modules\gridsome\lib\plugins\vue-templates\index.js:85:23) at contentType.collection.find.forEach.node (C:\wamp64\www\gridsome\node_modules\gridsome\lib\plugins\vue-templates\index.js:53:12) at Array.forEach (<anonymous>) at VueTemplates.createTemplate (C:\wamp64\www\gridsome\node_modules\gridsome\lib\plugins\vue-templates\index.js:52:35) at VueTemplates.createTemplates (C:\wamp64\www\gridsome\node_modules\gridsome\lib\plugins\vue-templates\index.js:30:12) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7)

【问题讨论】:

  • 我还有:模板:{ Shop: [ { path: '/shop/:id', component: 'templates/Shop.vue' } ] },

标签: vue.js directus gridsome


【解决方案1】:

为该值的每个集合添加一个字段“路径”。多么奇怪。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-12
    • 2017-08-20
    • 2013-03-20
    • 2020-03-05
    • 1970-01-01
    • 2021-10-09
    • 2015-12-07
    • 1970-01-01
    相关资源
    最近更新 更多