A
A
Artur Galyaev2021-01-18 14:30:00
Vue.js
Artur Galyaev, 2021-01-18 14:30:00

How to solve problems in a recursive component without violating SOLID principles?

1. The component has 2 "modes" of display
60056f5b233a2792308891.png
600570dabdea3016916986.png
How to do it through slots? (The slot must have category props, please note that this is a recursive component)
2. Data can be different on different pages, for example, on page 1:

{
    name: "test",
    items: [{name: "test"}, ...]
}

another:
{
    title: "test",
    items: [{title: "test"}, ...]
}

The problem is that the component itself is called (recursion) and it also needs to adapt the data to the props, how to solve this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question