yii2 layui弹出层layer.open 中的content问题

layui 官网地址 https://layer.layui.com/

1、 页面层,type类型应该为1
layer.open({
type: 1,
title: '内容区域',
 content: '传入任意的文本或html' //这里content是一个普通的String
area: ["700px", "250px"],
});

2、如果是iframe层 或者某个页面,type类型应该为2
layer.open({
type: 2,
content: 'http://sentsin.com' //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no']
});

 

3、用layer.open执行tips层

layer.open({

    type: 4,

    content: ['内容', '#id'] //数组第二项即吸附元素选择器或者DOM

});

4、

//Ajax获取

$.post('url', {}, function(str){

      layer.open({

         type: 1,

         content: str //注意,如果str是object,那么需要字符拼接。

     });

});

 

学习笔记,仅供参考!如有侵权,请联系!

你可能感兴趣的:(yii,php,yii)