我在使用Gridsome和Directus显示子页面时遇到问题

问题描述 投票:1回答:1

感谢阅读!

我正在尝试在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)
vue.js directus gridsome
1个回答
0
投票

向该值的每个集合添加字段“路径”。真奇怪。

© www.soinside.com 2019 - 2024. All rights reserved.