|
@@ -3,11 +3,8 @@ import UAParser from "ua-parser-js";
|
|
|
const ua = new UAParser();
|
|
|
|
|
|
function printUA() {
|
|
|
- console.log(
|
|
|
- `浏览器名称:${ua.getBrowser().name || "undefined"} 浏览器版本:${
|
|
|
- ua.getBrowser().version || "undefined"
|
|
|
- }`
|
|
|
- );
|
|
|
+ const { name, version } = ua.getBrowser();
|
|
|
+ console.log(`浏览器名称:${name} 浏览器版本:${version}`);
|
|
|
|
|
|
console.log(ua.getEngine(), ua.getDevice(), ua.getCPU(), ua.getOS());
|
|
|
}
|
|
@@ -15,13 +12,8 @@ function printUA() {
|
|
|
printUA();
|
|
|
|
|
|
export default function () {
|
|
|
- console.log(parseInt(ua.getBrowser().version || "", 10));
|
|
|
- if (
|
|
|
- ua.getBrowser().name !== "Blink" ||
|
|
|
- parseInt(ua.getBrowser().version || "", 10) <= 80
|
|
|
- ) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
+ const { name, version } = ua.getBrowser();
|
|
|
+ console.log(parseInt(version || "", 10));
|
|
|
+ // 满足要求的浏览器
|
|
|
+ return name === "Blink" && parseInt(version || "", 10) >= 80;
|
|
|
}
|