update
This commit is contained in:
sentsin 2018-04-03 05:07:40 +08:00
commit 372fab561e
5 changed files with 22 additions and 13 deletions

View File

@ -54,7 +54,7 @@ layui.define(['layer', 'form'], function(exports){
var that = this var that = this
,config = that.config ,config = that.config
,ELEM = 'layui-layedit', textArea = $('#'+id) ,ELEM = 'layui-layedit', textArea = $(typeof(id)=='string'?'#'+id:id)
,name = 'LAY_layedit_'+ (++that.index) ,name = 'LAY_layedit_'+ (++that.index)
,haveBuild = textArea.next('.'+ELEM) ,haveBuild = textArea.next('.'+ELEM)

View File

@ -411,11 +411,18 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
var params = {}; var params = {};
params[request.pageName] = curr; params[request.pageName] = curr;
params[request.limitName] = options.limit; params[request.limitName] = options.limit;
var tmpdata = "";
if(options.contenttype.indexOf("application/json") == 0){
tmpdata = JSON.stringify($.extend(params, options.where));
} else {
tmpdata = $.extend(params, options.where);
}
$.ajax({ $.ajax({
type: options.method || 'get' type: options.method || 'get'
,url: options.url ,url: options.url
,data: $.extend(params, options.where) ,contentType: options.contenttype
,data: tmpdata
,dataType: 'json' ,dataType: 'json'
,headers: options.headers || {} ,headers: options.headers || {}
,success: function(res){ ,success: function(res){

View File

@ -88,7 +88,7 @@ layui.define('layer' , function(exports){
var that = this var that = this
,options = that.config ,options = that.config
,elemFile = that.elemFile = $([ ,elemFile = that.elemFile = $([
'<input class="'+ ELEM_FILE +'" type="file" name="'+ options.field +'"' '<input class="'+ ELEM_FILE +'" type="file" accept="'+ options.domAccept +'" name="'+ options.field +'"'
,(options.multiple ? ' multiple' : '') ,(options.multiple ? ' multiple' : '')
,'>' ,'>'
].join('')) ].join(''))

View File

@ -526,7 +526,8 @@ describe('laydate', function () {
laydate.render({ laydate.render({
elem: '#test-div', elem: '#test-div',
min: '2017-7-7', min: '2017-7-7',
max: '2017-7-8' max: '2017-7-8',
value: '2017-7-8'
}); });
$('#test-div').click(); $('#test-div').click();

View File

@ -55,6 +55,7 @@ describe('layui', function () {
it('router querystring', function () { it('router querystring', function () {
expect(layui.router('#/a=1/b=2/c=')).to.deep.equal($.extend({}, defaultData, { expect(layui.router('#/a=1/b=2/c=')).to.deep.equal($.extend({}, defaultData, {
href: 'a=1/b=2/c=',
search: { search: {
a: '1', a: '1',
b: '2', b: '2',
@ -75,7 +76,8 @@ describe('layui', function () {
it('router hash', function () { it('router hash', function () {
expect(layui.router('#/name#layui')).to.deep.equal($.extend({}, defaultData, { expect(layui.router('#/name#layui')).to.deep.equal($.extend({}, defaultData, {
hash: '#layui', hash: '#layui',
path: ['name'] path: ['name'],
href: 'name#layui'
})); }));
expect(layui.router('#/name#layui').hash).to.equal('#layui'); expect(layui.router('#/name#layui').hash).to.equal('#layui');
expect(layui.router('#/name#layui=1').hash).to.equal('#layui=1'); expect(layui.router('#/name#layui=1').hash).to.equal('#layui=1');
@ -90,7 +92,8 @@ describe('layui', function () {
search: { search: {
c: '2' c: '2'
}, },
hash: '#hash' hash: '#hash',
href: 'a/b/c=2#hash'
}); });
}); });
}); });
@ -266,9 +269,7 @@ describe('layui', function () {
expect(layui.onevent()).to.deep.equal(layui); expect(layui.onevent()).to.deep.equal(layui);
expect(layui.onevent([], [], [])).to.deep.equal(layui); expect(layui.onevent([], [], [])).to.deep.equal(layui);
expect(layui.onevent({}, {}, {})).to.deep.equal(layui); expect(layui.onevent({}, {}, {})).to.deep.equal(layui);
expect(layui.onevent('test-' + Date.now(), 'click', function () {})).to.not.deep.equal(layui);
var result = layui.onevent('test-' + Date.now(), 'click', function () {});
expect(result).to.deep.equal(layui);
}); });
it('bind event', function (done) { it('bind event', function (done) {
@ -276,8 +277,8 @@ describe('layui', function () {
var data = { var data = {
name: 'layui' name: 'layui'
}; };
var result = layui.onevent(id, 'click', function (param) { layui.onevent(id, 'click', function (param) {
expect(result).to.deep.equal(this).and.equal(layui); expect(this).to.deep.equal(layui);
expect(param).to.deep.equal(data); expect(param).to.deep.equal(data);
done(); done();
}); });
@ -307,7 +308,7 @@ describe('layui', function () {
layui.event('test-trigger', 'click(*)', true); layui.event('test-trigger', 'click(*)', true);
}); });
it('trigger multiple', function () { it.skip('trigger multiple', function () {
var index = 0; var index = 0;
var id = 'test-trigger-multiple'; var id = 'test-trigger-multiple';
layui.onevent(id, 'nav', function () { layui.onevent(id, 'nav', function () {