


Let's talk about the technical principles of developing small programs with Vue
Vue, React and Angular are the three most widely used front-end frameworks. Judging from GitHub trends alone, Vue is ranked first, and it has reached 17 Thousands of Stars.
Currently, Vue is widely used in both major BAT companies and start-up companies. For any front-end engineer, Vue is a front-end framework worth learning.
But after domestic mini programs became a game-breaker for mobile development, Vue’s name was often associated with mini programs. Let’s explore the relationship between the two.
1. First, get to know Vue
Vue.js (pronounced /vjuː/, similar to view) is a set of tools for building user interfaces Progressive framework. Unlike other heavyweight frameworks, Vue adopts a bottom-up incremental development design. Vue's core library only focuses on the view layer, and is very easy to learn and integrate with other libraries or existing projects. Vue, on the other hand, is fully capable of powering complex single-page applications developed with single-file components and libraries supported by the Vue ecosystem.
The goal of Vue.js is to enable responsive data binding and composed view components through the simplest possible API. [Related recommendations: vuejs video tutorial, web front-end development]
The above is an explanation given by the Vue official website, which is still very abstract and obscure for most users. It’s difficult to understand. After reading it, you may still not understand what this framework is used for. What is a “progressive framework”? What is "bottom-up incremental development"? What is a "view layer"? What is a "single file component"? What is a "complex single-page application?" What is "responsive data binding and composed view components" in the second paragraph?
1.What exactly is Vue.js?
Presumably everyone uses an APP or web page to browse news online. Vue.js is a web-based application that is used to build a web-like form with many form items and the content needs to be modified according to the user's operations.
2. What is a single-page application?
A single-page application generally refers to a page that is an application. Of course, it can also be a sub-application. , for example, a page can be regarded as a sub-application. There is generally a lot of interactive processing in single-page applications, and the content on the page needs to change dynamically according to the user's operations.
3. What is the view layer?
Now we abstract a web page application, then the DOM in HTML is actually a view, a web page It is through the combination and nesting of DOM that the most basic view structure is formed, and then through CSS modification, the basic view structure is "make-up" to make them look more beautiful. Finally, when it comes to the interactive part, you need to use JavaScript to accept the user's interactive request, respond to the user's interactive operation through the event mechanism, and modify various data in the event processing function, such as modifying a certain DOM The innerHTML or innerText part. We can divide the DOM in HTML into a layer independently from other parts. This layer is called the view layer.
4. Responsive data binding
The responsiveness here is not the response in the @media media query style layout, but means that vue.js will automatically respond to changes in certain data on the page. As for how to respond, you can first paste the following code into a file with an html extension and then open it with a browser. Enter some text in the text box and observe the page changes.
5. Component development
When making a single-page application, the page interaction and structure are very complex. There are many components on one page. Modules need to be written, and often the amount of code and workload for a module is very large. If it is developed according to the original method, it will be tiring. Moreover, when product requirements change in the future, it will be very troublesome to modify. I am afraid that after one of the divs is moved, other divs will follow and the entire page will be messed up, or some inner DOM events will be modified due to the event bubbling mechanism of JavaScript. After processing the function, various inexplicable and weird bugs appear.
In object-oriented programming, we can use object-oriented ideas to package various modules into classes or split a large business module into more and smaller classes. In process-oriented programming, we can also split some large functions into many functions and then assign them to different people for development.
In front-end applications, can we also encapsulate modules like programming? This introduces the idea of component development.
Vue.js splits various modules in a single-page application into separate components (components) through components. We only need to write various component tags in the parent application first (taking advantage of the pit) , and write the parameters to be passed into the component in the component tag (just like passing parameters into the function, this parameter is called the attribute of the component), and then write the implementation of various components separately (fill in the pits), and then the entire application Even if it’s done.
2. The relationship between Vue and mini programs
First of all, it needs to be explained that Vue has no direct relationship with mini program development.
However, due to the influence of Vue and the many developers of Vue, many organizations have re-developed small programs in a form similar to Vue syntax (and finally converted them into native small programs through their own tools) syntax), such as Meituan’s mpVue (Vue.js in mini program). The advantage is that it reduces the cost for Vue developers to learn mini program development, and optimizes many shortcomings of mini programs. For example, mini programs cannot use Npm, cannot use CSS preprocessors, and are natively callback syntax, etc.
For example, mpVue is a front-end framework that uses Vue.js to develop small programs. The framework is based on the core of Vue.js. Mpvue has modified the runtime and compiler implementation of Vue.js so that it can run In the mini program environment, a complete Vue.js development experience is introduced for mini program development. Using Mpvue to develop small programs will gain some additional capabilities based on the technical system of small programs:
Thorough component development capabilities:
- Improve code reusability
- Complete Vue.js development experience
- Convenient Vuex data management solution: easy to build complex applications
- Fast webpack construction mechanism: custom build strategy, hotReload during development
- Support the use of npm external dependencies using the Vue.js command line tool vue-cli
- Quickly initialize the project
- The ability of H5 code conversion and compilation into small program target code
If you need to learn more about using mpVue to develop small programs, you can refer to the official documentation: http://mpvue.com/mpvue/#_1
## 3. How to make Mini programs can bring greater value
After understanding how to develop mini programs based on Vue, you can also understand how to better utilize the value of mini programs. This has to be mentioned in the Hybrid mode. Beginning to become popular, the architectural model of Native small programs has become a trend. It solves the problems of inflexible iteration, accumulation of code, and multi-platform maintenance caused by traditional apps. At the same time, it has an experience far superior to H5. What I want to recommend here is thesmall program container technology - FinClip that is already relatively mature in the market. By integrating the SDK, you can quickly give your APP the ability to run small programs.
In addition,FinClip’s separation of view layer and logic layer also brings many benefits:
1. Convenient data sharing and interaction between multiple mini program pages . Having the same context in the life cycle of the mini program can provide developers with a native application development background with a familiar coding experience; 2. The separation and parallel implementation of Service and View can prevent JS execution from affecting or Slow down page rendering, which helps to improve rendering performance; 3. Because JS is executed in the Service layer, the DOM operated in JS will not affect the View layer, so the applet cannot operate the DOM structure , which also makes the performance of small programs better than traditional H5.Compatible with WeChat applet development specifications.
In other words, the WeChat applet originally developed through Vue can also be placed in your own APP without changing the code. At the same time, a backend management page is provided, which can uniformly manage self-owned and externally developed mini programs and analyze the collected mini program data. (Learning video sharing:vuejs introductory tutorial, Basic programming video)
The above is the detailed content of Let's talk about the technical principles of developing small programs with Vue. For more information, please follow other related articles on the PHP Chinese website!

Vue.js is loved by developers because it is easy to use and powerful. 1) Its responsive data binding system automatically updates the view. 2) The component system improves the reusability and maintainability of the code. 3) Computing properties and listeners enhance the readability and performance of the code. 4) Using VueDevtools and checking for console errors are common debugging techniques. 5) Performance optimization includes the use of key attributes, computed attributes and keep-alive components. 6) Best practices include clear component naming, the use of single-file components and the rational use of life cycle hooks.

Vue.js is a progressive JavaScript framework suitable for building efficient and maintainable front-end applications. Its key features include: 1. Responsive data binding, 2. Component development, 3. Virtual DOM. Through these features, Vue.js simplifies the development process, improves application performance and maintainability, making it very popular in modern web development.

Vue.js and React each have their own advantages and disadvantages, and the choice depends on project requirements and team conditions. 1) Vue.js is suitable for small projects and beginners because of its simplicity and easy to use; 2) React is suitable for large projects and complex UIs because of its rich ecosystem and component design.

Vue.js improves user experience through multiple functions: 1. Responsive system realizes real-time data feedback; 2. Component development improves code reusability; 3. VueRouter provides smooth navigation; 4. Dynamic data binding and transition animation enhance interaction effect; 5. Error processing mechanism ensures user feedback; 6. Performance optimization and best practices improve application performance.

Vue.js' role in web development is to act as a progressive JavaScript framework that simplifies the development process and improves efficiency. 1) It enables developers to focus on business logic through responsive data binding and component development. 2) The working principle of Vue.js relies on responsive systems and virtual DOM to optimize performance. 3) In actual projects, it is common practice to use Vuex to manage global state and optimize data responsiveness.

Vue.js is a progressive JavaScript framework released by You Yuxi in 2014 to build a user interface. Its core advantages include: 1. Responsive data binding, automatic update view of data changes; 2. Component development, the UI can be split into independent and reusable components.

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.

Netflix's choice in front-end technology mainly focuses on three aspects: performance optimization, scalability and user experience. 1. Performance optimization: Netflix chose React as the main framework and developed tools such as SpeedCurve and Boomerang to monitor and optimize the user experience. 2. Scalability: They adopt a micro front-end architecture, splitting applications into independent modules, improving development efficiency and system scalability. 3. User experience: Netflix uses the Material-UI component library to continuously optimize the interface through A/B testing and user feedback to ensure consistency and aesthetics.


Hot AI Tools

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

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

Undress AI Tool
Undress images for free

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

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool