JS:layer.prompt层小试

思路:可通过设置title改变标题,通过设置fromtype改变样式;

1. title可变,输入类型为text,无fromtype;

样式

在这里插入图片描述

代码

```
    layer.prompt({title: '请输入'+expressT+'面单号,并确认'}, function(slogisticCode, index){
        layer.close(index);
        layer.msg('您输入的'+expressT+'面单号为:'+ slogisticCode );
        $.ajax({
            type: "POST",
            url: "/manage/order/modifySlogisticCode",
            data: {
                id: goodsId,
                expressType: expressType,
                slogisticCode: slogisticCode
            },
            dataType: "json",
            success: function (data) {
                if (data.res == 1) {
                    layer.msg("面单号提交成功")
                    $("#orderTable").dataTable().fnDraw(true);
                } else {
                    alert(data.resMsg);
                }
            }
        });
    });
```

2. title可变,输入类型为password,fromtype=1;

样式
在这里插入图片描述

代码

layer.prompt({title: '请输入'+expressT+'面单号,并确认'}, function(slogisticCode, index){
变为 layer.prompt({title: '请输入'+expressT+'面单号,并确认', formType: 1}, function(slogisticCode, index){


3. title可变,输入类型为text,fromtype=2;

样式

在这里插入图片描述

代码

layer.prompt({title: '请输入'+expressT+'面单号,并确认'}, function(slogisticCode, index){
变为 layer.prompt({title: '请输入'+expressT+'面单号,并确认', formType: 2}, function(slogisticCode, index){

猜你喜欢

转载自blog.csdn.net/u011374582/article/details/83753523