-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#### 2024-05-29 | ||
|
||
- 新增「User Agent 解析」小工具 | ||
|
||
#### 2024-05-14 | ||
|
||
- 新增「媒体文件元数据解析」小工具 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<script setup lang="ts"> | ||
import { type IResult, UAParser } from 'ua-parser-js' | ||
const userAgentValue = ref('') | ||
const userAgentResult = ref<IResult>() | ||
const userAgentResultStr = computed(() => JSON.stringify(userAgentResult.value)) | ||
const parser = new UAParser() | ||
useHead({ | ||
title: 'User Agent 解析', | ||
meta: [ | ||
{ | ||
name: 'description', | ||
content: '在线解析 User Agent 字符串,获取浏览器、操作系统等信息', | ||
}, | ||
], | ||
}) | ||
onMounted(() => { | ||
userAgentValue.value = navigator.userAgent | ||
parser.setUA(userAgentValue.value) | ||
userAgentResult.value = parser.getResult() | ||
}) | ||
function onInpugChange() { | ||
parser.setUA(userAgentValue.value) | ||
userAgentResult.value = parser.getResult() | ||
} | ||
</script> | ||
|
||
<template> | ||
<page header="User Agent 解析" class="page-user-agent-parser"> | ||
<div class="user-agent-input"> | ||
<div class="title"> | ||
User Agent | ||
</div> | ||
<el-input | ||
v-model="userAgentValue" | ||
placeholder="请输入 User Agent 字符串,回车确认" | ||
@change="onInpugChange" | ||
/> | ||
</div> | ||
|
||
<div v-if="userAgentResult?.ua" class="user-agent-result"> | ||
<div class="title"> | ||
解析结果 | ||
</div> | ||
<json-viewer | ||
:json-string="userAgentResultStr" | ||
:sort="false" | ||
:preview-mode="true" | ||
/> | ||
</div> | ||
</page> | ||
</template> | ||
<style lang="scss"> | ||
.page-user-agent-parser { | ||
.title { | ||
font-size: 14px; | ||
font-weight: bold; | ||
margin-bottom: 10px; | ||
} | ||
.user-agent-input { | ||
margin-bottom: 20px; | ||
input { | ||
font-size: 14px; | ||
font-family: var(--code-font-family); | ||
} | ||
} | ||
.json-viewer-wrapper { | ||
border: 1px solid var(--el-border-color); | ||
border-radius: var(--el-input-border-radius, var(--el-border-radius-base)); | ||
} | ||
} | ||
</style> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.