国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Web Front-end Vue.js What is the difference between vue3.0 and vue2.0?

What is the difference between vue3.0 and vue2.0?

Nov 18, 2020 pm 03:01 PM
vue

Difference: In vue2.0, no matter how big the data is, an observer will be created for it at the beginning; when the data is large, this may cause obvious performance pressure when the page is loaded. Vue3.0 will only create observers for "the data used to render the initial visible part", and vue3.0's observers are more efficient.

What is the difference between vue3.0 and vue2.0?

##The difference between vue3.0 and 2.0

Vue-cli3.0 in 8 It was officially released on March 11th. After reading the comments, the compatibility is not very good and there are many changes in the commands. I am not particularly optimistic.

Compared with vue2.0, the advantages of the release of vue3.0 are mainly reflected in: Faster, smaller, easier to maintain, easier to native, easier for developers;

faster 1. Virtual DOM is completely rewritten, mounting & patching is 100% faster ;
2. More compile-time reminders to reduce runtime overhead;
3. Proxy-based observer mechanism to meet full language coverage and better performance;
4. Abandon Object. defineProperty, use faster native Proxy;
5. Component instance initialization speed is increased by 100%;
6. Speed ??is doubled/memory usage is reduced by half;

is smaller 1. Tree-shaking is more friendly;
2. New core runtime: ~ 10kb gzipped;

================

3.0 Newly added TypeScript and PWA support

Some commands have changed:

  • Download and install npm install -g vue@cli

  • Deleted vue list

  • Create project vue create

  • Start project npm run serve

  • The default project directory structure has also changed:

  • The configuration file directory, config and build folders have been removed

  • Removed the static folder, added a public folder, and moved index.html to public

  • Added a views folder in the src folder for classifying view components And public components


Note:

php Chinese online work has also begun to teach the latest version of the vue course. Interested friends can learn more .

Installation

npm install -g vue@cli

Create project file:


vue create project //項目的名稱

============= =======

The difference between vue2 and vue3

1. Common commands

vue -V Check the local vue version

2. Official document

3.0: https://cli.vuejs.org/zh/

3. Create file

3.0: vue create enter the project file folder to create the project.

2.0: vue init webpack

4. Start the project

3.0 Start npm run serve

2.0 Start npm run dev

build Gone, the config is gone, oh, and the most important point is that node-model is automatically downloaded when installing the 3.0 project.

Create a vue.config.js in the root directory

module.exports = {
 baseUrl: process.env.NODE_ENV === 'production' ? '/online/' : '/',
 // outputDir: 在npm run build時 生成文件的目錄 type:string, default:'dist'
 // outputDir: 'dist',
 // pages:{ type:Object,Default:undfind }
 devServer: {
 port: 8888, // 端口號
 host: 'localhost',
 https: false, // https:{type:Boolean}
 open: true, //配置自動啟動瀏覽器
 // proxy: 'http://localhost:4000' // 配置跨域處理,只有一個代理
 proxy: {
 '/api': {
 target: &#39;<url>&#39;,
 ws: true,
 changeOrigin: true
 },
 &#39;/foo&#39;: {
 target: &#39;<other_url>&#39;
 }
 }, // 配置多個代理
 }
 }

==================

The difference between Vue3.0 and Vue2.0

1. Lazy observation is performed by default.

In version 2.x, no matter how big the data is, observers will be created for it at the beginning. When the data is large, this can cause significant performance pressure when the page loads. In version 3.x, observers will only be created for "data used to render the initial visible part", and 3.x observers are more efficient.

2. More accurate change notifications.

In proportion: in version 2.x, when you use Vue.set to add a property to an object, all watchers of this object will be re-run; in version 3.x, only those that depend on that property The watcher will run again.

3. 3.0 has newly added support for TypeScript and PWA

4. Some commands have changed:

Download and install npm install -g vue@cli

Deleted vue list

Create project vue create

Start project npm run serve

5. The default project directory structure has also changed:

The configuration file directory, config and build folders were removed

The static folder was removed, the public folder was added, and index.html was moved to public

In the src folder A new views folder is added for classifying view components and public components

Related recommendations:


2020 Summary of front-end vue interview questions (with answers) )

vue tutorial recommendation: The latest 5 vue.js video tutorial selections in 2020

For more programming-related knowledge, please visit:

Programming Teaching! !

The above is the detailed content of What is the difference between vue3.0 and vue2.0?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to add functions to buttons for vue How to add functions to buttons for vue Apr 08, 2025 am 08:51 AM

You can add a function to the Vue button by binding the button in the HTML template to a method. Define the method and write function logic in the Vue instance.

React vs. Vue: Which Framework Does Netflix Use? React vs. Vue: Which Framework Does Netflix Use? Apr 14, 2025 am 12:19 AM

Netflixusesacustomframeworkcalled"Gibbon"builtonReact,notReactorVuedirectly.1)TeamExperience:Choosebasedonfamiliarity.2)ProjectComplexity:Vueforsimplerprojects,Reactforcomplexones.3)CustomizationNeeds:Reactoffersmoreflexibility.4)Ecosystema

Netflix's Frontend: Examples and Applications of React (or Vue) Netflix's Frontend: Examples and Applications of React (or Vue) Apr 16, 2025 am 12:08 AM

Netflix uses React as its front-end framework. 1) React's componentized development model and strong ecosystem are the main reasons why Netflix chose it. 2) Through componentization, Netflix splits complex interfaces into manageable chunks such as video players, recommendation lists and user comments. 3) React's virtual DOM and component life cycle optimizes rendering efficiency and user interaction management.

How to jump to the div of vue How to jump to the div of vue Apr 08, 2025 am 09:18 AM

There are two ways to jump div elements in Vue: use Vue Router and add router-link component. Add the @click event listener and call this.$router.push() method to jump.

React, Vue, and the Future of Netflix's Frontend React, Vue, and the Future of Netflix's Frontend Apr 12, 2025 am 12:12 AM

Netflix mainly uses React as the front-end framework, supplemented by Vue for specific functions. 1) React's componentization and virtual DOM improve the performance and development efficiency of Netflix applications. 2) Vue is used in Netflix's internal tools and small projects, and its flexibility and ease of use are key.

How to jump a tag to vue How to jump a tag to vue Apr 08, 2025 am 09:24 AM

The methods to implement the jump of a tag in Vue include: using the a tag in the HTML template to specify the href attribute. Use the router-link component of Vue routing. Use this.$router.push() method in JavaScript. Parameters can be passed through the query parameter and routes are configured in the router options for dynamic jumps.

How to implement component jump for vue How to implement component jump for vue Apr 08, 2025 am 09:21 AM

There are the following methods to implement component jump in Vue: use router-link and &lt;router-view&gt; components to perform hyperlink jump, and specify the :to attribute as the target path. Use the &lt;router-view&gt; component directly to display the currently routed rendered components. Use the router.push() and router.replace() methods for programmatic navigation. The former saves history and the latter replaces the current route without leaving records.

How to use vue pagination How to use vue pagination Apr 08, 2025 am 06:45 AM

Pagination is a technology that splits large data sets into small pages to improve performance and user experience. In Vue, you can use the following built-in method to paging: Calculate the total number of pages: totalPages() traversal page number: v-for directive to set the current page: currentPage Get the current page data: currentPageData()

See all articles