feat: 新增工具:URL编码/解码

This commit is contained in:
taoran
2023-12-04 18:33:34 +08:00
parent 48bf2b2198
commit f1544b65a4
3 changed files with 82 additions and 0 deletions
+13
View File
@@ -90,6 +90,15 @@ function getTools() {
url: '/random_password',
cateId: 2,
cate: '开发运维',
},
{
id: 1,
title: 'URL编码/解码',
logo: 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
desc: 'URL在线编码解码工具(UrlEncode编码 和 UrlDecode解码)',
url: '/urlencode',
cateId: 2,
cate: '开发运维',
}
]
}
@@ -116,6 +125,10 @@ function getToolsCate() {
{
id: 6,
title: '查询相关'
},
{
id: 7,
title: '其他'
}
]
}
+61
View File
@@ -0,0 +1,61 @@
<script setup lang="ts">
import { reactive } from 'vue'
import DetailHeader from '@/components/Layout/DetailHeader/DetailHeader.vue'
import { copy } from '@/utils/string'
const info = reactive({
title: "URL编码/解码",
content: '',
tranRes: '',
})
//编码
const toEncode = () => {
info.tranRes = ''
info.tranRes = encodeURIComponent(info.content)
}
//解码
const toDecode = () => {
info.tranRes = ''
info.tranRes = decodeURIComponent(info.content)
}
//clear
const clear = () => {
info.content = ''
info.tranRes = ''
}
//copy
const copyRes = async () => {
copy(info.tranRes)
}
</script>
<template>
<div class="flex flex-col mt-3 ml-4 flex-1 mr-10">
<DetailHeader :title="info.title"></DetailHeader>
<div>
<div>
<el-input type="textarea" :rows="8" v-model="info.content"></el-input>
</div>
<div class="mt-4">
<el-button type="primary" @click="toEncode">UrlEncode编码</el-button>
<el-button type="primary" @click="toDecode">UrlDecode解码</el-button>
<el-button type="primary" @click="copyRes">复制结果</el-button>
<el-button type="danger" @click="clear">清空内容</el-button>
</div>
<div class="mt-3 min-h-md bg-gray-100 p-3 mb-3">
<el-input type="textarea" :rows="8" v-model="info.tranRes"></el-input>
</div>
</div>
</div>
</template>
<style scoped>
</style>
+8
View File
@@ -88,6 +88,14 @@ export const constantRoute = [
title: "随机密码生成"
}
},
{
path: '/urlencode',
component: () => import('@/components/UrlEncode/UrlEncode.vue'),
name: 'urlencode',
meta: {
title: "URL编码/解码"
}
},
{
path: '/404',
component: () => import('@/components/404/404.vue'),