如何从 es6-module 访问 app.vue 方法?
How to access app.vue methods from es6-module?
我正在使用 webpack、vuex 和 vue-router 构建一个 vuejs 应用程序。
我的项目结构如下所示:
[组件]
- BlockingLayer.vue
[店铺]
- index.js
[restapi]
- index.js
App.vue
main.js
我在 App.vue 中使用 BlockingLayer.vue。 App.vue 有 show/hide BlockingLayer 的方法。
现在我希望能够从 [restapi] index.js 触发这些方法 - 我该怎么做?
我尝试在我的 restapi 模块中导入 App.vue - 不起作用。同时,在 restapi 中导入商店可以完美运行。在商店内导入 restapi 并在那里使用它也可以正常工作。我能做的是在商店内部使用一个变量,而不是在 App.vue 到 show/hide 我猜的 BlockingLayer 中使用变量,但这并不是我想说的真正的商店用途...
我正在使用 vuex 将 BlockingLayer 和 vuex 操作的状态存储到 show/hide 它而不是现在将状态存储在 App.vue 中。很有魅力。
我正在使用 webpack、vuex 和 vue-router 构建一个 vuejs 应用程序。
我的项目结构如下所示:
[组件]
- BlockingLayer.vue
[店铺]
- index.js
[restapi]
- index.js
App.vue
main.js
我在 App.vue 中使用 BlockingLayer.vue。 App.vue 有 show/hide BlockingLayer 的方法。
现在我希望能够从 [restapi] index.js 触发这些方法 - 我该怎么做?
我尝试在我的 restapi 模块中导入 App.vue - 不起作用。同时,在 restapi 中导入商店可以完美运行。在商店内导入 restapi 并在那里使用它也可以正常工作。我能做的是在商店内部使用一个变量,而不是在 App.vue 到 show/hide 我猜的 BlockingLayer 中使用变量,但这并不是我想说的真正的商店用途...
我正在使用 vuex 将 BlockingLayer 和 vuex 操作的状态存储到 show/hide 它而不是现在将状态存储在 App.vue 中。很有魅力。