light7ui 刷新子页面 js不能加载的问题
来源:互联网 发布:阿里云建ss 编辑:程序博客网 时间:2024/05/20 06:23
当使用light7库写移动端,页面刷新后,当前页面js事件失效
http://light7.cn/components/#init
http://light7.cn/components/#router
原文
Call $.init() to init all components in page。
We will not init page on document loaded, because $.config.autoInit = false
;. You should call $.init() on document loaded
. $.init
method will init all components in page, and trigger a pageInit event after init complete. You should call $.init
after all pageInit events has binded.
But the page Loaded By router will always be inited.
Do not modify $.init
please.
If you set $.config.autoInit = true
;, the$.init
method will auto be called after document onload. But your pageInit binds may have not executed at this time. So, please do not set autoInit=true
, unless you don’t listen to pageInit event or you can make sure that your code will be right.
see demofor more usage.
JS和CSS等脚本问题
当通过ajax加载新页面的时候,路由器会自动忽略新页面的JS和CSS脚本。所以请把全部页面的脚本都打包到入口页面。在demo中我们每个页面都引用了相同的脚本,是为了在子页面刷新的时候也可以用。
在入口index页面引入所有js,调用$.init()
初始化每个页面对应的pageinit做法如下:
$(document).ready(function(){//关键 //页面1 $(pageinit,#id,function(){ $(".button").click(function(){ //只有加上document.ready和$.init(),次方法才会在页面刷新后,重新初始化起效 }) //页面2 $(pageinit,#id2,function(){ $(".button2").click(function(){ //只有加上document.ready和$.init(),次方法才会在页面刷新后,重新初始化起效 }) }) $.init()//关键 })
- light7ui 刷新子页面 js不能加载的问题
- js 弹出子页面与关闭子页面刷新父页面的问题
- js 弹出子页面与关闭子页面刷新父页面的问题
- js 弹出子页面与关闭子页面刷新父页面的问题
- js 弹出子页面与关闭子页面刷新父页面的问题
- Ext JS Panel加载页面刷新的问题
- js 刷新子页面
- js指定页面刷新(子页面刷新子页面)
- js实现子页面关闭的时候父页面刷新
- 关于easyui加载子页面无法加载js问题
- JSP页面不能刷新、防止刷新的问题总结
- JSP页面不能刷新、防止刷新的问题总结
- js刷新页面问题
- js刷新页面方法大全\js刷新框架子页面的七种方法
- js 关闭子页面刷新父页面
- webview加载页面,JS方法不能加载的问题解决
- 解决showModalDialog弹出的子窗口不能刷新的问题
- js刷新框架子页面的七种方法
- 分布式与集群的区别
- qgis编译
- android中出现"androidsdk/build-tools/23.0.2/aapt.exe"finished with...错误以及drawable/下的图片命名格式
- 数据挖掘经典算法概述以及详解链接
- cf#301-D - Bad Luck Island-概率dp(水 )
- light7ui 刷新子页面 js不能加载的问题
- java内置数据类型
- Android gallery+BaseAdapter实现简易的图片查看器
- C++设计模式<一>:简介
- QObject::connect: Cannot queue arguments of type 'XXX'
- 第一个ios程序中的问题
- 【AJAX】$.get()方法补充知识
- memcached 命令行参数说明
- Android Studio使用记录