first commit
This commit is contained in:
45
h5/js/utils/index.js
Normal file
45
h5/js/utils/index.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 工具函数
|
||||
*/
|
||||
class Utils {
|
||||
|
||||
constructor () {
|
||||
setTimeout(()=> this.AppBack(),100)
|
||||
}
|
||||
|
||||
AppBack() {
|
||||
document.querySelector(".icon-back1") && document.querySelector(".icon-back1").addEventListener('click',function () {
|
||||
history.back()
|
||||
})
|
||||
}
|
||||
|
||||
GetQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return decodeURIComponent(r[2]); return null;
|
||||
}
|
||||
|
||||
SetHeaderTitle(title) {
|
||||
document.querySelector(".header_theme1 span").innerText = title
|
||||
}
|
||||
|
||||
longPress(Dom, func, timeout = 500) {
|
||||
var timeOutEvent;
|
||||
Dom.addEventListener('touchstart', function (e) {
|
||||
clearTimeout(timeOutEvent);
|
||||
timeOutEvent = setTimeout(function () {
|
||||
func();
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
Dom.addEventListener('touchmove', function (e) {
|
||||
clearTimeout(timeOutEvent);
|
||||
});
|
||||
|
||||
Dom.addEventListener('touchend', function (e) {
|
||||
clearTimeout(timeOutEvent);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var utils = new Utils();
|
||||
Reference in New Issue
Block a user