search
HomeWeb Front-endVue.jsLet's talk about the technical principles of developing small programs with Vue

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?
Lets talk about the technical principles of developing small programs with Vue

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.
Lets talk about the technical principles of developing small programs with Vue

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.
Lets talk about the technical principles of developing small programs with Vue

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 the

small 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.


Lets talk about the technical principles of developing small programs with Vue

There is another point worth recommending,

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!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete
What Happens When the Vue.js Virtual DOM Detects a Change?What Happens When the Vue.js Virtual DOM Detects a Change?May 14, 2025 am 12:12 AM

WhentheVue.jsVirtualDOMdetectsachange,itupdatestheVirtualDOM,diffsit,andappliesminimalchangestotherealDOM.ThisprocessensureshighperformancebyavoidingunnecessaryDOMmanipulations.

How Accurate Is It to Think of Vue.js's Virtual DOM as a Mirror of the Real DOM?How Accurate Is It to Think of Vue.js's Virtual DOM as a Mirror of the Real DOM?May 13, 2025 pm 04:05 PM

Vue.js' VirtualDOM is both a mirror of the real DOM, and not exactly. 1. Create and update: Vue.js creates a VirtualDOM tree based on component definitions, and updates VirtualDOM first when the state changes. 2. Differences and patching: Comparison of old and new VirtualDOMs through diff operations, and apply only the minimum changes to the real DOM. 3. Efficiency: VirtualDOM allows batch updates, reduces direct DOM operations, and optimizes the rendering process. VirtualDOM is a strategic tool for Vue.js to optimize UI updates.

Vue.js vs. React: Scalability and MaintainabilityVue.js vs. React: Scalability and MaintainabilityMay 10, 2025 am 12:24 AM

Vue.js and React each have their own advantages in scalability and maintainability. 1) Vue.js is easy to use and is suitable for small projects. The Composition API improves the maintainability of large projects. 2) React is suitable for large and complex projects, with Hooks and virtual DOM improving performance and maintainability, but the learning curve is steeper.

The Future of Vue.js and React: Trends and PredictionsThe Future of Vue.js and React: Trends and PredictionsMay 09, 2025 am 12:12 AM

The future trends and forecasts of Vue.js and React are: 1) Vue.js will be widely used in enterprise-level applications and have made breakthroughs in server-side rendering and static site generation; 2) React will innovate in server components and data acquisition, and further optimize the concurrency model.

Netflix's Frontend: A Deep Dive into Its Technology StackNetflix's Frontend: A Deep Dive into Its Technology StackMay 08, 2025 am 12:11 AM

Netflix's front-end technology stack is mainly based on React and Redux. 1.React is used to build high-performance single-page applications, and improves code reusability and maintenance through component development. 2. Redux is used for state management to ensure that state changes are predictable and traceable. 3. The toolchain includes Webpack, Babel, Jest and Enzyme to ensure code quality and performance. 4. Performance optimization is achieved through code segmentation, lazy loading and server-side rendering to improve user experience.

Vue.js and the Frontend: Building Interactive User InterfacesVue.js and the Frontend: Building Interactive User InterfacesMay 06, 2025 am 12:02 AM

Vue.js is a progressive framework suitable for building highly interactive user interfaces. Its core functions include responsive systems, component development and routing management. 1) The responsive system realizes data monitoring through Object.defineProperty or Proxy, and automatically updates the interface. 2) Component development allows the interface to be split into reusable modules. 3) VueRouter supports single-page applications to improve user experience.

What are the disadvantages of VueJs?What are the disadvantages of VueJs?May 05, 2025 am 12:06 AM

The main disadvantages of Vue.js include: 1. The ecosystem is relatively new, and third-party libraries and tools are not as rich as other frameworks; 2. The learning curve becomes steep in complex functions; 3. Community support and resources are not as extensive as React and Angular; 4. Performance problems may be encountered in large applications; 5. Version upgrades and compatibility challenges are greater.

Netflix: Unveiling Its Frontend FrameworksNetflix: Unveiling Its Frontend FrameworksMay 04, 2025 am 12:16 AM

Netflix uses React as its front-end framework. 1.React's component development and virtual DOM mechanism improve performance and development efficiency. 2. Use Webpack and Babel to optimize code construction and deployment. 3. Use code segmentation, server-side rendering and caching strategies for performance optimization.

See all articles

Hot AI Tools

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.

Undress AI Tool

Undress AI Tool

Undress images for free

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 Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools