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

layui加载模块时,getPath探测layui组件src有bug,必须要求layui.js在整个<script>标签的最后引入 #368

Open
andylieonian opened this issue Nov 8, 2018 · 0 comments

Comments

@andylieonian
Copy link

@andylieonian andylieonian commented Nov 8, 2018

layui.js中,getPath方法探测layui所在目录代码存在bug,只有layui.js在页面中最后引入时,才能正确找到layui路径。
,getPath = function(){
var jsPath = doc.currentScript ? doc.currentScript.src : function(){
var js = doc.scripts
,last = js.length - 1
,src;
for(var i = last; i > 0; i--){
if(js[i].readyState === 'interactive'){
if(js[i].src.substring(js[i].src.lastIndexOf("/")+1) == 'layui.js') {//应该加上这一句
src = js[i].src;
break;
}
}
}
return src || js[last].src;
}();
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
}()

@andylieonian andylieonian changed the title layui记载模块时,getPath探测layui组件src有bug,必须要求layui.js在整个<script>标签的最后引入 layui加载模块时,getPath探测layui组件src有bug,必须要求layui.js在整个<script>标签的最后引入 Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.