Home > Web Front-end > Layui Tutorial > Introduction to the problem of layui time control crashing

Introduction to the problem of layui time control crashing

Release: 2019-11-30 13:37:41
Original
2913 people have browsed it

Introduction to the problem of layui time control crashing

When the project went online, it was discovered that the time control crashed on the sub-page of the backend management system layui, and the time could not be selected at all.

The reason is: if multiple nodes are found on the page, only the first node can be used normally and the subsequent nodes will crash. It can be understood that currently laydate does not support rendering multiple nodes at one time. It's not a matter of duplicate instances, because the instances I create for each page are different and it still crashes. In the background management system, this kind of parent-child page does have multiple pages that use time controls, thereby rendering multiple nodes.

Solution:

The default configuration in the laydate file, trigger: 'focus' //The focus of the event of the callout control is changed to click.

The test deployment is effective online.

layui.use('laydate', function(){
    var laydate = layui.laydate;

    //日期时间选择器
    laydate.render({
        elem: '#startTime'
        ,type: 'datetime'
        ,trigger: 'click'//呼出事件改成click
        //,format: 'yyyy-MM-dd HH:mm:ss' //可任意组合
    });
    //日期时间选择器
    laydate.render({
        elem: '#endTime'
        ,type: 'datetime'
        ,trigger: 'click'//呼出事件改成click
        // ,format: 'yyyy-MM-dd HH:mm:ss' //可任意组合
    });
});
Copy after login

For more layui knowledge, please pay attention to the layui usage tutorial column.

The above is the detailed content of Introduction to the problem of layui time control crashing. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template