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.
##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;
- 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@cliCreate project file:
vue create project //項目的名稱============= =======
The difference between vue2 and vue3
1. Common commandsvue -V Check the local vue version2. Official document3.0: https://cli.vuejs.org/zh/3. Create file3.0: vue create enter the project file folder to create the project. 2.0: vue init webpack4. Start the project3.0 Start npm run serve2.0 Start npm run devbuild 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: '<url>', ws: true, changeOrigin: true }, '/foo': { target: '<other_url>' } }, // 配置多個代理 } }==================
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 PWA4. Some commands have changed: Download and install npm install -g vue@cliDeleted vue listCreate project vue createStart project npm run serve5. The default project directory structure has also changed: The configuration file directory, config and build folders were removedThe static folder was removed, the public folder was added, and index.html was moved to publicIn the src folder A new views folder is added for classifying view components and public componentsRelated recommendations:For more programming-related knowledge, please visit:
2020 Summary of front-end vue interview questions (with answers) )
vue tutorial recommendation: The latest 5 vue.js video tutorial selections in 2020
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!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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.

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

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.

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.

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.

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.

There are the following methods to implement component jump in Vue: use router-link and <router-view> components to perform hyperlink jump, and specify the :to attribute as the target path. Use the <router-view> 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.

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()
