首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Vue3 的有什么特性?

As we mentioned in the introduction, thereare concepts in Vue that are available from other frameworks. Directivesmanipulate the Document Object Model(DOM) just like in Angular.js and Angular.Templates render data like we do with Angular. It also has its own specialsyntax for data binding and adding directives.

正如我们在介绍中提到的,Vue 中的一些概念可以从其他框架中获得。指令可操作文档对象模型(DOM),就像在 Angular.js 和 Angular 中一样。模板会像 Angular 一样渲染数据。此外,Vue 还有自己的特殊语法用于数据绑定和添加指令。

Angular and React both have props that passdata between components. We can also loop through array and object entries todisplay items from lists. Also, like Angular, we can add plugins to a Vueproject to extend its functionality.

Angular 和 React 都有在组件间传递数据的道具。我们还可以循环使用数组和对象条目来显示列表中的项目。此外,与 Angular 一样,我们也可以为 Vue 项目添加插件来扩展其功能。

Concepts that are exclusive to Vue.jsinclude computed properties, which are component properties that are derivedfromother properties. Also, Vue components have watchers that let us watch forreactive data changes. Reactive data is data that is watched by Vue.js andactions are done automatically when reactive data changes.

Vue.js 独有的概念包括计算属性,即从其他属性派生出来的组件属性。此外,Vue 组件还具有监视器,可让我们监视反应数据的变化。反应数据是被 Vue.js 监视的数据,当反应数据发生变化时,Vue.js 会自动执行操作。

As reactive data changes, other parts of acomponent and other components that reference those values are all updatedautomatically. This is the magic of Vue. It is one of the reasons that we cando so much with so little code. It takes care of the task of watching for datachanges for us, so that we don’t have to do that.

当反应数据发生变化时,组件的其他部分和引用这些值的其他组件都会自动更新。这就是 Vue的神奇之处。这也是我们能用这么少的代码完成这么多工作的原因之一。它为我们解决了观察数据变化的任务,因此我们无需再做这些工作。

Another unique feature of Vue 3 is that wecan add the framework and its libraries with script tags. This means that if wehave a legacy frontend, we can still use Vue 3 and its libraries to enhancelegacy frontends. Also, we don’t need to add build tools to build our app. Thisis a great feature that isn’t available with most other popular frameworks.

Vue 3 的另一个独特功能是,我们可以通过脚本标签添加框架及其库。这意味着,如果我们有一个传统前端,我们仍然可以使用 Vue 3 及其库来增强传统前端。此外,我们无需添加构建工具来构建应用程序。这是大多数其他流行框架所不具备的强大功能。

There’s also the popular Vue Router libraryfor touting, and the Vuex library for state management. They have all beenupdated to be compatible with Vue 3, so we can use them safely. This way, wedon’t have to worry about which router and state management library to use aswe do with other frameworks such as React. Angular comes with its own routes,but no standard state management library has been designated.

此外,还有流行的 Vue Router 库(用于路由管理)和 Vuex 库(用于状态管理)。它们都已更新为与 Vue 3 兼容,因此我们可以安全地使用它们。这样,我们就不必像使用 React 等其他框架那样,为使用哪种路由器和状态管理库而烦恼了。Angular 自带路由,但没有指定标准的状态管理库。

  • 发表于:
  • 原文链接https://page.om.qq.com/page/ODXlz-1FbNp7sOqF7CDrvm9w0
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券
http://www.vxiaotou.com