2

我在 shell 应用程序中使用 Vue Web 组件时遇到问题,这个 shell 应用程序也是在 Vue 中开发的。

我的 Vue Web 组件有自己的 Vue 路由器,并且在我编写的这个 Web 组件的 router.js 内部Vue.use(VueRouter)。同样,我的 shell 应用程序有自己的 Vue 路由器,我也在Vue.use(VueRouter)他们的 router.js 中使用了相同的路由器。

我在 shell 应用程序的文件中添加了我的 web 组件 js (webcomponet-project/dist/sample-web-component.js),index.html如下所示:

<script src = "../webcomponet-project/dist/sample-web-component.js"></script>

现在当我启动 shell 应用程序时,我收到以下错误?

Uncaught TypeError: Cannot redefine property: $router

我能做些什么来摆脱这个错误?

4

0 回答 0