解決layui 彈窗中 table 寬度無法自適應問題

                  layer.open({
                            type: 1,
                            title: "",
                            shade: 0,
                            offset: 'lt',
                            resizing: function () {
                                table.resize('shipList');
                            },
                            resize: true,
                            maxmin: true,
                            area: ['30%', '30%'],
                            content: '<table  id="shipList" style="width: 100%" lay- 
                                       filter="shipList"></table>',
                            success: function (layero, index) {
                                table.render({
                                    elem: '#shipList'
                                    , data: data_ship
                                    , cols: [[ //表頭
                                         {fixed: 'right', title: '操作', toolbar: 
                                          '#barDemo'}
                                    ]]
                                    , even: true
                                });
                            },
                            cancel: function (index, layero) {
                              
                            }
                        });

在layer.open 中加入 resizing: 屬性,執行tale.resize("表格id") 即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章