E
E
elrevin2018-09-18 22:36:27
Vue.js
elrevin, 2018-09-18 22:36:27

How to organize access to vue components from other components?

Good afternoon, colleagues.
Please tell me how to be in this situation:
there is an application in php (the engine for the site), it has different modules (a different number for different sites), and there is an admin module that builds the main admin interface and has a bunch of vue components for this (buttons , data grids, etc.). But each module has its own component, which builds an interface for editing module data. The structure looks like this:

admin-module
      vue
          Приложение админки с базовыми компонентами
some-module
      vue
          Компонент для редактирования данных

I assemble the module components into vue web components with the command vue-cli-service build --target wc --name some-module-editor ./src/SomeModuleEditor.vue
After assembly, this component can be used in the admin panel by dynamically loading its assembly and changing the value is on the tag in the right place.
But there is one catch: in the SomeModuleEditor.vue component, you cannot use the basic components from the admin panel (the same buttons, data grids, etc.), when I try to build the component, I get the error:
Module build failed (from ./node_modules/eslint-loader /index.js):
Error: No ESLint configuration found.
if I add this to SomeModuleEditor.vue:
import InDefaultButton from "../../../vuecp/assets/vue/src/componets/buttons/InDefaultButton";
    export default {
        components: {InDefaultButton}
    }

Making one application for the admin panel and stupidly building it is not an option, since the modules are installed by simply copying the folder with the module. And the admin panel does not know anything about modules (it does not directly access them, does not include or use anything), but modules know about the admin panel and, in theory, can use components.
Many thanks in advance for your advice.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kokovin, 2019-02-09
@Per_Ardua

There are at least two options:
1. Use non-vue-cli for the build, or upgrade the config so that the build does not try to connect the eslint-loader, which is not there, but takes it from places where it is.
2. Make a package for vue components from the admin panel, publish and use. Or do not publish, but simply link if there is a ban on it.
Most likely there are more options)
PS Some late answer =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question