intercept-click.js
516 Bytes
/**
* 拦截跳转, 在这里给将要打开的页面设置一下 header 样式
* @return {[type]}
*/
const yoho = require('yoho');
const matchHeader = (url) => {
if (/product\/(\d+)/.test(url)) {
return {
title: '商品详情'
};
}
return '';
};
module.exports = (url) => {
console.log(url);
if (yoho.isApp) {
yoho.goNewPage({
header: matchHeader(url),
url: url
});
} else {
// location.href = url;
}
};