Shopware 6插件开发:如何在侧边导航添加插件设置链接
Shopware 6插件:主侧边导航添加插件设置页面链接
我正在开发Shopware 6插件,希望在主侧边导航中添加指向插件设置页面的链接(对应指定导航项与目标页面截图),目前已尝试以下Vue.js模块代码:
// VueJS Module ... navigation: [ { id: 'm28.scg.settings', label: 'scg.settings.title', color: '#ff3d58', path: 'sw.extension.module', params: { moduleName: 'MindsShoppingCartGoals' }, icon: 'default-device-server', parent: 'm28.scg', position: 0 } ] ...
核心配置说明:
- ID唯一性:
id: 'm28.scg.settings'必须全局唯一,建议遵循「插件前缀.功能模块」的命名规则 - 翻译文本配置:
label: 'scg.settings.title'是翻译键,需在插件的src/Resources/app/administration/src/snippet目录下的对应语言文件中配置具体文本,比如在en-GB.json中添加"scg.settings.title": "Shopping Cart Goals Settings" - 路由匹配规则:
path: 'sw.extension.module'对应Shopware内置的扩展模块路由,params里的moduleName必须和插件中注册的模块名称完全一致,否则无法跳转至目标页面 - 父级菜单挂载:
parent: 'm28.scg'需指定插件在侧边导航中的父级菜单项ID,确保设置菜单作为子项挂载到正确位置 - 样式与排序:
position: 0控制子菜单在父级中的显示顺序(数值越小越靠前),color和icon用于自定义菜单视觉样式
内容的提问来源于stack exchange,提问作者Leon Schwanitz
相关产品推荐
相关产品推荐

