use_app_goto_page: (skip_type, skip_target) => {
// Android App
if (/android/i.test(navigator.userAgent)) {
try {
app_response = window.android.gotoPage(skip_type, skip_target)
} catch (e) {
console.log(e)
}
// iOS App
} else if (/ios|iphone|ipod|pad/i.test(navigator.userAgent)) {
try {
// ios 只能接收一个参数,所以只能传递字符串
app_response = window.webkit.messageHandlers.gotoPage.postMessage(
JSON.stringify({
skipType: skip_type,
skipTarget: skip_target
})
);
} catch (e) {
console.log(e)
}
}
}
// gotoPage 是app提供的方法,我们只要在需要的地方调用就好