用于 jquery.mobile-1.4.5 错误的 Jquery.mobile.splitview
"cannot call methods on pagecontainer prior to initialization; attempted to call method 'change'"
这是由于升级 JQM 1.2.1 到 JQM 1.4.5 而没有 jquery.mobile.splitview 升级。
问题:JQM 1.4.5 是否有任何 jquery.mobile.splitview
Uncaught Error: cannot call methods on pagecontainer prior to initialization; attempted to call method 'change'
at Function.error (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:254:9)
at HTMLDivElement.<anonymous> (http://localhost:3000/assets/jquery.mobile-1.4.5.self-31d65ee183ce6d4c0e27b21fad8429156ee18d418063e7f9caf860b612092cc8.js?body=1:928:15)
at Function.each (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:371:19)
at jQuery.fn.init.each (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:138:17)
at jQuery.fn.init.$.fn.(anonymous function) [as pagecontainer] (http://localhost:3000/assets/jquery.mobile-1.4.5.self-31d65ee183ce6d4c0e27b21fad8429156ee18d418063e7f9caf860b612092cc8.js?body=1:920:9)
at Object.$.mobile.changePage (http://localhost:3000/assets/jquery.mobile-1.4.5.self-31d65ee183ce6d4c0e27b21fad8429156ee18d418063e7f9caf860b612092cc8.js?body=1:5845:26)
at http://localhost:3000/assets/jquery.mobile.splitview.self-e15baccb65d7aa3afefe9b440484be73123530a8d491f74c462e7f9b27757ac8.js?body=1:34:20
at HTMLDocument.<anonymous> (http://localhost:3000/assets/jquery.turbolinks.self-176b9819f30444d441e820bbccd3264fe57753aeafd54dec732b0dbc77129a2a.js?body=1:30:16)
at HTMLDocument.dispatch (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:5227:27)
at HTMLDocument.elemData.handle (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:4879:28)
jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:254 Uncaught Error: cannot call methods on pagecontainer prior to initialization; attempted to call method 'change'
at Function.error (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:254:9)
at HTMLDivElement.<anonymous> (http://localhost:3000/assets/jquery.mobile-1.4.5.self-31d65ee183ce6d4c0e27b21fad8429156ee18d418063e7f9caf860b612092cc8.js?body=1:928:15)
at Function.each (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:371:19)
at jQuery.fn.init.each (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:138:17)
at jQuery.fn.init.$.fn.(anonymous function) [as pagecontainer] (http://localhost:3000/assets/jquery.mobile-1.4.5.self-31d65ee183ce6d4c0e27b21fad8429156ee18d418063e7f9caf860b612092cc8.js?body=1:920:9)
at Object.$.mobile.changePage (http://localhost:3000/assets/jquery.mobile-1.4.5.self-31d65ee183ce6d4c0e27b21fad8429156ee18d418063e7f9caf860b612092cc8.js?body=1:5845:26)
at http://localhost:3000/assets/jquery.mobile.splitview.self-e15baccb65d7aa3afefe9b440484be73123530a8d491f74c462e7f9b27757ac8.js?body=1:34:20
at HTMLDocument.<anonymous> (http://localhost:3000/assets/jquery.turbolinks.self-176b9819f30444d441e820bbccd3264fe57753aeafd54dec732b0dbc77129a2a.js?body=1:30:16)
at HTMLDocument.dispatch (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:5227:27)
at HTMLDocument.elemData.handle (http://localhost:3000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:4879:28)
但是在我更改 //= 的顺序后,需要在 jquery.mobile.splitview 之前加载 jquery.mobile-1.4.5,错误消失了。
//= require jquery
//= require jquery.turbolinks
// require jquery_ujs
//= require jquery.mobile-1.4.5
//= require jquery.mobile.splitview
//= require jquery.mobile.datebox
//= require iscroll-wrapper
//= require iscroll
//= require turbolinks
//= require ckeditor/init
// require rails-ujs
新问题:屏幕未按应有的方式拆分,但已显示
在阅读了其他问题后,我怀疑 jquery.mobile.splitview.js 中的函数 $.mobile.changePage在JQM-1.4.5 中已被弃用