vue.js - 我在使用 Gridsome 和 Directus 显示子页面时遇到问题
问题描述
谢谢阅读!
我正在尝试在我的 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)
解决方案
Add a field "path" to each collection of that value. How strange.
推荐阅读
- javascript - 选择 5 张时排队要立即上传的图像
- c# - 如何区分具有相同 id 的两个 WebElement?
- exchangewebservices - 日历 - 对约会应用搜索过滤器(主题)
- vb.net - 如何以另一种语言显示日期时间选择器
- sql - “INSERT INTO ... ON CONFLICT DO NOTHING”在检查约束处停止
- macos - 将 Maven bin 添加到 PATH 变量后获得权限被拒绝问题,也无法在根模式下添加到 PATH
- cplex - 不可行的解决方案,绝对可行 - CPLEX
- laravel - Laravel-Snappy PDF 突然停止工作 - Windows
- scala - 为什么不一样?
- mysql - 获取主表中每一行的每个连接表的行数