layui use summary

1. Select the drop-down box, which needs to be refreshed after default use to display

To use the modules of layui, you need to load the required modules first

layui.use(['form'], function(){
    var form = layui.form; //Only after this step is performed, some form elements will be automatically decorated successfully
    var $ = layui.$;
    //However, if you The HTML is dynamically generated, automatic rendering will fail

    //So you need to execute the following method to render manually in the corresponding place, similar to this is element.init();

   //This step is the key

    form.render();  

});

2. Execute a method. When you want to update the data in the form, you need to perform one step update rendering

form.render(); //update all

form.render('select'); //Refresh the rendering of the select selection box

3. When using layui's submit to submit and monitor asynchronously, be sure to add return false at the end


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324969714&siteId=291194637