Vue.js 外部包使用基础项目上定义的组件
假设以下场景:
- 我开发了一个基础项目,其中定义了一些 vue.js 组件(全局到该项目)。我们将它们命名为 comp_A 和 comp_B。
- 我正在开发另一个项目(一个单独的node.js包),它将作为Vue.js插件安装在基础项目上,并将充当外部应用程序,添加基础项目的更多功能(新组件、新路线......)。
我面临的问题是这个外部应用程序需要使用一些在基础项目上本地定义的组件(例如 comp_A 和 comp_B)。 如何实现这一目标?
我想到的一个解决方案是将这些通用组件外部化到一个单独的库中,以便两个项目都可以使用它们。但现在这不是一个选择。
Suppose the following scenario:
- I have develop a base project which have defined some vue.js components (globally to that project). Let's name them comp_A and comp_B.
- I'm developing another project (a separate node.js package) which will be installed as a Vue.js plugin on the base project and will act as external application, adding more functionalities to the base project (new components, new routes..).
The problem I'm facing is that this external application needs to consume some components that are defined locally on the base project (like comp_A and comp_B). How do I achieve that?
One solution that comes to my mind, is to externalize this common components into a separate library so they can be consumed by both of the projects. But that's not an option right now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论