42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
|
// export default function ({ req, redirect, route, navigator }) {
|
||
|
// const isMobile = (ua) => {
|
||
|
// return !!ua.match(/AppleWebKit.*Mobile.*/);
|
||
|
// };
|
||
|
// const userAgent = req
|
||
|
// ? req.headers["user-agent"]
|
||
|
// : navigator
|
||
|
// ? navigator.userAgent
|
||
|
// : "" || "";
|
||
|
// // const userAgent = navigator.userAgent.toLowerCase();
|
||
|
// // const userAgent = req ? req.headers["user-agent"] : navigator.userAgent;
|
||
|
|
||
|
// // 若终端为pc 但是路径中包含/m 重定向到pc
|
||
|
// // console.log(route.fullPath.includes());
|
||
|
// // console.log(route.fullPath.substring(1));
|
||
|
// let source;
|
||
|
// const rq = route.query.source;
|
||
|
// if (rq) {
|
||
|
// source = "?source=" + rq;
|
||
|
// } else {
|
||
|
// source = "";
|
||
|
// }
|
||
|
|
||
|
// if (route.path.includes("/m") && !isMobile(userAgent)) {
|
||
|
// // const url = route.fullPath.substring(2) || "/";
|
||
|
// redirect("/" + source);
|
||
|
// }
|
||
|
|
||
|
// // 若终端为m 但是路径中不包含/m 重定向到m
|
||
|
// if (
|
||
|
// (!route.path.indexOf("/m") || !route.path.includes("/m/")) &&
|
||
|
// isMobile(userAgent)
|
||
|
// ) {
|
||
|
// // const url = route.fullPath.substring(1);
|
||
|
// // console.log(url);
|
||
|
// console.log(source);
|
||
|
// redirect("/m" + source);
|
||
|
// }
|
||
|
// }
|
||
|
export default function () {}
|
||
|
|