Vue:一个网站可以有多个 Vue 应用程序吗? [英] Vue: is multiple Vue apps for a single website okay?

查看:52
本文介绍了Vue:一个网站可以有多个 Vue 应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Hugo 静态网站,我正在使用 Vue 将其动态化.我们正在过渡.长期计划尚未确定,但在中间阶段我们正在使用 Vue.

I have a Hugo static website that I am making dynamic using Vue. We are transitioning. The long term plan is not yet confirmed but in the intermediate stage we are using Vue.

我已经在一个页面上有一个 Vue 应用程序,现在我需要使用 Vue 实现另一个页面.所以我想我会为此制作另一个 Vue 应用程序.这是可以接受的做法还是违反推荐的做法?

I already have a Vue app on one page and now I need to implement another page using Vue. So I am thinking that I will make another Vue app for that. Is this acceptable practice or is it against the recommended practice?

第一个 vue 应用程序用于提交表单.其次是获取和显示项目列表.

First vue app is for submitting a form. Second is for getting and displaying a list of items.

推荐答案

这绝对是可以接受的做法.

Definitely it's acceptable practice.

Vue 可用于单页面应用程序,但在传统的基于多页面的应用程序中使用它并没有错.在这种情况下,一个 Vue 应用程序可以是这样一个页面上的一个小部件",无论大小.

Vue can be used for single-page apps, but there's nothing wrong in using it in a traditional multiple page-based application. In this context, one Vue app can be one "widget" on such a page, big or small.

当您需要在多个组件之间共享数据时,就会需要有一个中央"组件.您可能会到达那里 - 但您现在无需担心.

The need to have one "central" component will come the moment you'll require sharing data between multiple components. You'll probably get there - but you don't need to worry about it now.

事实上,Vue 的主要优势之一是在这种特定设置中易于使用.您可以将其逐步引入您的代码库,从几个组件开始,然后慢慢走向现代应用.

In fact, one of major advantages of Vue is the ease of use in this particular setup. You can introduce it to your codebase step by step, start with a few components, and slowly make your way towards a modern app.

GitLab 以经历从 jQuery 到 Vue 的重大渐进式重写而闻名,看看他们的故事:

GitLab is known for going through a major progressive rewrite from jQuery to Vue, have a look at their story:

这篇关于Vue:一个网站可以有多个 Vue 应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆