Currently tackling a large application filled with legacy code, I'm facing a repetitive issue that has popped up twice already. It's becoming clear to me that there must be a more efficient way to solve this problem. Here's what I'm dealing with.
There are three distinct pages within the app where I need to introduce similar Vue functionality. However, the challenge lies in the fact that these pages have vastly different HTML/Blade templates. As a result, it feels like I have to provide separate HTML/Blade templates to the component alongside the component props.
To navigate this dilemma, I've managed to utilize Vue inline-templates that effectively address the varying HTML/Blade template issue.
Nevertheless, an ongoing concern persists - I currently have three individual .js
Vue components, each corresponding to a specific page. Although functional, the Vue code within these files shares striking similarities.
In addition, there's a possibility that down the line I'll need to incorporate more distinctive Vue code into each component, and I want to keep that option open.
My goal is to discover a method to reuse the largely similar Vue code across all components. While I've toyed with the idea of nesting the same child component inside these three separate components, the differences in their HTML/Blade structure seem to present an obstacle.
If you have any suggestions on how to tackle this conundrum, I would greatly appreciate your input. The last thing I want is to end up duplicating an excessive amount of Vue code!