Using React.js and Vue.js Together in Laravel(在 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?
推荐答案
是的.这绝对是可能的.多语言编程是当今的现实.您可以采取几种方法.最常见的方法是 micro-frontends.
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 组件不是很友好.它在许多高级测试上都失败了.
Note: React is not very friendly with web-components. It fails on many advanced tests.
这篇关于在 Laravel 中同时使用 React.js 和 Vue.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Laravel 中同时使用 React.js 和 Vue.js


基础教程推荐
- 如何在特定日期之前获取消息? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01