Home > Article > Web Front-end > What are the advantages and disadvantages of layui framework
The advantage of the layui framework is that it is a lightweight framework, which is simple and suitable for back-end development; the disadvantage is that the technology is not very mature yet, and it is more troublesome to interact with the front-end because it needs to query the DOM operation
layui is A modular front-end framework that is popular for its simple yet substantial nature. Today I will introduce the advantages and disadvantages of the layui framework, which has certain reference value and I hope it will be helpful to everyone.
【Recommended course: javascript tutorial】
layui meaning:
layui is a front-end UI framework written using its own module specifications. It follows the native HTML/CSS/JS writing method. Although it is minimalist in appearance, it is rich in content and contains many components from core code to API, which are very suitable for rapid development of interfaces. In fact, layui is more for back-end developers, and it has its own mode. More lightweight and simple
The advantages and disadvantages of layui
The advantages are as follows:
( 1) layui is a lightweight framework, simple and beautiful. Suitable for developing back-end mode, it has very good results on server-side pages.
(2) layui is the best UI framework provided to back-end developers. It is based on DOM driver. As long as it does not involve interaction, layui is still very good.
The disadvantages are as follows:
(1) layui appeared late, and it must be that other front-end frameworks are still immature. Now it has been updated to version 2.
##Case: Implement carousel effect through layui framework(1) Externally import layui files
<link rel="stylesheet" type="text/css" href=".\layui-v2.4.5\layui\css\layui.css">
<script src=.\layui-v2.4.5\layui\layui.js></script>
<div class="layui-carousel" id="test1" lay-filter="carofilter" style="font-size:larger">
<div carousel-item>
<div style="background-color:pink;">图1</div>
<div style="background-color:lightblue">图2</div>
<div style="background-color:blue">图3</div>
<div style="background-color:mediumorchid">图4</div>
<div style="background-color:orange">图5</div>
</div>
</div>
<script src=.\layui-v2.4.5\layui\layui.js></script>
<script>
layui.use('carousel', function () {
var carousel = layui.carousel;
var ins=carousel.render({
elem: '#test1'
, width: '450px' //设置容器宽度
, arrow: 'always' //始终显示箭头,可选hover,none
//,anim: 'updown' //切换动画方式,可选fade,default
, full: false //全屏
, autoplay: true //自动切换
, interval: 1000 //自动切换的时间间隔
, index: 3 //初始化时item索引,默认时0
, indicator:'inside' //指示器位置,可选outside,none
});
//监听轮播切换事件
carousel.on('change(carofilter)', function (obj) { //test1来源于对应HTML容器的
lay-filter="test1" 属性值
console.log(obj.index); //当前条目的索引
console.log(obj.prevIndex); //上一个条目的索引
console.log(obj.item); //当前条目的元素对象
});
//重置轮播
ins.reload({arrow:'hover'});//将arror从alway变成hover
});
</script>
Effect picture:
Summary: The above is this This is the entire content of this article. I hope this article can help everyone learn the layui framework better
The above is the detailed content of What are the advantages and disadvantages of layui framework. For more information, please follow other related articles on the PHP Chinese website!