当前位置:网站首页>Composition API的优势
Composition API的优势
2022-07-26 01:54:00 【_洋】
Composition API(组合式API)是vue3的写法,通俗地理解组合式API就是在setup中对数据(data),方法(methods)等进行配置。
vue2中使用的是Options API(配置式API)
Options API
使用传统OptionsAPI中,新增或者修改一个需求,就需要分别在data,methods,computed里修改。
功能不能独立出来,如果功能特别多就显得很乱。
图示:(一个颜色代表一个功能)
Composition API
我们可以更加优雅的组织我们的代码,函数。让相关功能的代码更加有序的组织在一起。
如:我们使用hook函数,将一个功能放在一个hook函数中,需要使用的时候直接在setup中使用.use引入即可。实现了功能的分离,代码更加有序。
图示:(一个颜色代表一个功能)
边栏推荐
- FFT用于估计插值后的图像重采样因子
- The detailed knowledge summary of MySQL can be collected
- Maximum side length of elements and squares less than or equal to the threshold (source: leetcode)
- 旅行 (拆点分层)
- "Wei Lai Cup" 2022 Niuke summer multi school training camp 2 personal problem sets
- proto转换Dart | 项目使用Protobuf | flutter 使用grpc
- Summary after reading "poor dad and rich dad"
- C# 迭代器的实现
- Redis6.x配置参数详解
- excel中怎么显示数字/英文时间
猜你喜欢

How to use the pagoda panel to deploy the full stack project of node to the server

The sales volume has won the championship repeatedly. Is the secret of Wuling's success only low price?

Silicon Valley classroom - official account cloud on demand Silicon Valley classroom microservice project practical notes

Integer data type in C language (do you really understand it)

excel中怎么显示数字/英文时间

SVN version control branch and merge function use

【Verilog数字系统设计(夏宇闻)4-----Verilog语法的基本概念2】

AutoCAD -- Method of calculating area

pdf. JS introduction

What is a test case? How to design?
随机推荐
在Anaconda 中安装和使用R
y77.第四章 Prometheus大厂监控体系及实战 -- prometheus的服务发现机制(八)
怎么使用宝塔面板把node全栈项目部署到服务器上
销量连连夺冠,五菱的成功秘诀只有低价吗?
Worthington核酸酶、微球菌相关研究及测定方案
What is the difference between for... In... And for... Of
【深入浅出玩转FPGA学习11----Testbench书写技巧1】
MySQL locking table problem
Leetcode algorithm 147. insert and sort the linked list
How to use the pagoda panel to deploy the full stack project of node to the server
Proto conversion dart | project uses protobuf | fluent uses grpc
4QAM, 16QAM modulation and demodulation simulation circuit, observe and analyze QAM constellation and bit error rate curve [matlab code]
Why does the debugger display the wrong function
“蔚来杯“2022牛客暑期多校训练营2 D.[Link with Game Glitch] 二分答案+SPFA判环
FFT用于估计插值后的图像重采样因子
Niuke - bm39 serialized binary tree [hard]
“蔚来杯“2022牛客暑期多校训练营2 H.[Take the Elevator] 维护线段
MPLS knowledge points
Worthington木瓜蛋白酶丨从纯化的蛋白聚糖生产糖肽(附文献)
AUTOCAD——计算面积的方法