Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

遍历元素指定路径问题修复 #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/laydate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,8 @@
"use strict";

var isLayui = window.layui && layui.define, ready = {
getPath: function(){
var jsPath = document.currentScript ? document.currentScript.src : function(){
var js = document.scripts
,last = js.length - 1
,src;
for(var i = last; i > 0; i--){
if(js[i].readyState === 'interactive'){
src = js[i].src;
break;
}
}
return src || js[last].src;
}();
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
}()

//获取节点的style属性值
,getStyle: function(node, name){
getStyle: function(node, name){
var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null);
return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name);
}
Expand Down Expand Up @@ -68,7 +52,22 @@
v: '5.0.9'
,config: {} //全局配置项
,index: (window.laydate && window.laydate.v) ? 100000 : 0
,path: ready.getPath
,path: ''
,getPath: function(){
var jsPath = document.currentScript ? document.currentScript.src : function(){
var js = document.scripts
,last = js.length - 1
,src;
for(var i = last; i > 0; i--){
if(js[i].readyState === 'interactive'){
src = js[i].src;
break;
}
}
return src || js[last].src;
}();
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
}

//设置全局项
,set: function(options){
Expand Down Expand Up @@ -106,6 +105,7 @@
//组件构造器
,Class = function(options){
var that = this;
laydate.path = laydate.path || laydate.getPath();
that.index = ++laydate.index;
that.config = lay.extend({}, that.config, laydate.config, options);
laydate.ready(function(){
Expand Down Expand Up @@ -1863,4 +1863,4 @@
}()
);

}();
}();