在Laravel中一起使用React.js和Vue.js

编程入门 行业动态 更新时间:2024-10-27 12:26:48
本文介绍了在Laravel中一起使用React.js和Vue.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我真的很想知道,是否可以在laravel中将彼此相邻的react.js和vue.js一起使用?例如,将ReactJs用于管理仪表板,而将VueJs用于客户端仪表板.我知道使用其中一种在技术上和逻辑上都更好. 你怎么认为?我们可以一起使用吗?

I really want to know, is it possible to using react.js and vue.js next to each other in a laravel? For Example, use ReactJs for admin dashboard and use VueJs for client dashboard. I know it's technically and logically better to use one of them. What do you think? Can we use them together?

推荐答案

是.绝对有可能.多种语言编程是当今的现实.您可以采取几种方法.最常见的方法是 微前端 .

Yes. It is definitely possible. Polyglot programming is today's reality. There are a couple of approaches you can take. A most common approach would be that of a micro-frontends.

如何实现微前端取决于您!但通常,您将在两条不同的路线上使用两个不同的SPA.您将使用超链接/锚标签将这两个应用程序相互链接.但是,请注意,这样做的成本很高,确实意味着非常大的应用程序和构建它们的团队.

How you implement micro-frontend is up to you! But in general, you will have two different SPA served on two different routes. You will interlink these two applications using hyperlinks/anchor tags. However, note that, doing something that is a big cost and really meant for very large applications and teams building them.

有许多叶子组件,如按钮,链接,下拉列表等,最终将为这两个框架开发和维护.状态管理,路由,服务将针对每个框架进行重写.在框架之间匹配一致的样式指南非常痛苦.

There are many leaf components like buttons, links, dropdown, etc. which you will end up developing and maintaining for both frameworks. State management, routing, services will be rewritten for each framework. It is incredibly painful to match consistent style guide across frameworks.

如今,如果您确实需要继续使用此方法,则可以考虑对叶子组件使用自定义元素.它们应适用于许多SPA框架(请参阅注释).这将帮助您省去重新设计轮子的麻烦.

Nowadays, if you really need to go ahead with this approach, you can consider using custom-elements for your leaf components. They should work for many SPA frameworks (see the notes). This will help you save the trouble of reinventing the wheel.

注意:React对Web组件不是很友好.在许多高级测试中失败.

更多推荐

在Laravel中一起使用React.js和Vue.js

本文发布于:2023-11-24 19:25:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626505.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:React   Laravel   Vue   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!