Home >Web Front-end >Front-end Q&A >Is layui based on jquery?

Is layui based on jquery?

WBOY
WBOYOriginal
2022-05-12 10:42:453166browse

layui is based on jquery, a UI framework written with its own module, and comes with jquery itself; the method of using jquery inside layui is "layui.use('jquery',function(){var $ =layui.$ jQuery code})".

Is layui based on jquery?

The operating environment of this tutorial: windows10 system, jquery3.2.1&&layui v2.6.8 version, Dell G3 computer.

Is layui based on jquery?

layui is a framework based on jQuery and comes with jQuery itself.

Layui uses jQuery internally

According to the official recommendation, it is better to use the one that comes with it

Here is the method of using jQuery internally:

layui.use('jquery', function(){ 
  var $ = layui.$ //重点处
  
  //后面就跟你平时使用jQuery一样
  
});

Assignment Use ajax

$ = layui.jquery;

for $, or layui.jquery.ajax. If you do not assign a value, an undefined prompt for $ will appear.

Extended knowledge:

layui is a front-end UI framework written using its own module specifications, following the writing and organization of native HTML/CSS/JS Form, the threshold is extremely low, and it is ready to use. It is minimalist on the outside but full on the inside. It is light in size and rich in components. Every detail from the core code to the API has been carefully crafted, making it very suitable for rapid interface development. The first version of layui was released in the autumn of 2016. It is different from those UI frameworks based on the bottom layer of MVVM, but it does not go against the grain, but believes in returning to nature. To be precise, it is more tailored for server-side programmers. Developers do not need to get involved in the complex configuration of various front-end tools. They only need to face the browser itself, making development very convenient.

Why use layui?

layui is more oriented to back-end developers, so in terms of organizational form, it resolutely adopts the AMD-like module management method that uses the browser as the host a few years ago, but it is not limited to It has its own pattern that is more lightweight and simpler than CommonJS. Layui is defined as "classic modularity". It does not deliberately emphasize the concept of "module" itself, but intentionally avoids the mainstream solutions of the current JS community and tries to interpret efficiency in the simplest way possible! Its so-called classic lies in its obsession with returning to nature. It organizes modules in a way that is generally recognized by current browsers! layui believes that this lightweight organization method can still fill many scenarios beyond WebPack. Therefore, it insists on using classic modularity, which allows people to avoid the complex configuration of tools and return to the original HTML/CSS/JavaScript itself!

Compatibility and scenario-oriented

layui is compatible with all browsers currently used by humans (except IE6/7), and can be used as a quick fix for the PC-side backend system and front-end interface. Development program.

Main modules

layui provides a wealth of built-in modules, all of which can be loaded on demand through a modular approach, including: layer, layDate, layPage, laytpl , table, form, upload, element, tree, layeditor, rate, carousel, flow, util, code, etc.

Recommended related video tutorials: jQuery video tutorial

The above is the detailed content of Is layui based on jquery?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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