feat(工具箱): 完善逻辑,动态生成路由
This commit is contained in:
9
src/views/ToolboxView/Calculation/CalcDownloadTime.vue
Normal file
9
src/views/ToolboxView/Calculation/CalcDownloadTime.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Calculation/CalcRatio.vue
Normal file
9
src/views/ToolboxView/Calculation/CalcRatio.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Conversion/ConvertHtmlEntities.vue
Normal file
9
src/views/ToolboxView/Conversion/ConvertHtmlEntities.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Conversion/ConvertTimestamp.vue
Normal file
9
src/views/ToolboxView/Conversion/ConvertTimestamp.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Conversion/UrlEncodeDecode.vue
Normal file
9
src/views/ToolboxView/Conversion/UrlEncodeDecode.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Edit/CsvEditor.vue
Normal file
9
src/views/ToolboxView/Edit/CsvEditor.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Generator/GenerateRandomString.vue
Normal file
9
src/views/ToolboxView/Generator/GenerateRandomString.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Generator/GenerateUrls.vue
Normal file
9
src/views/ToolboxView/Generator/GenerateUrls.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Minecraft/CalcChunkLocation.vue
Normal file
9
src/views/ToolboxView/Minecraft/CalcChunkLocation.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Minecraft/UuidConverter.vue
Normal file
9
src/views/ToolboxView/Minecraft/UuidConverter.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Network/WebSocketTestTool.vue
Normal file
9
src/views/ToolboxView/Network/WebSocketTestTool.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Other/OpenNewWindow.vue
Normal file
9
src/views/ToolboxView/Other/OpenNewWindow.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
9
src/views/ToolboxView/Other/RunJavaScript.vue
Normal file
9
src/views/ToolboxView/Other/RunJavaScript.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<div class="tool-detail-page"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
</style>
|
@@ -1,9 +1,11 @@
|
||||
<template>
|
||||
<div class="toolbox-view flex-col">
|
||||
<div class="app-view-header">
|
||||
<span>{{ TOOLBOX_MODULE_TITLE }}</span>
|
||||
<span>{{ routeTitle }}</span>
|
||||
</div>
|
||||
<div class="app-view-content is-transparent">
|
||||
|
||||
<!-- 工具列表 -->
|
||||
<div class="tool-list">
|
||||
<n-collapse
|
||||
:default-expanded-names="toolList.map(item => item.id)"
|
||||
@@ -20,8 +22,10 @@
|
||||
<!-- 工具项 -->
|
||||
<div
|
||||
v-for="toolItem in categoryItem.items"
|
||||
v-show="toolItem.enabled"
|
||||
:key="toolItem.id"
|
||||
class="tool-item shadow-1"
|
||||
@click="handleOpenTool(toolItem)"
|
||||
>
|
||||
<div class="item-header">
|
||||
<span :class="['item-icon', toolItem.iconClass || 'mdi mdi-package-variant-closed']"></span>
|
||||
@@ -40,6 +44,15 @@
|
||||
|
||||
</n-collapse>
|
||||
</div>
|
||||
|
||||
<!-- 工具页面 -->
|
||||
<div
|
||||
v-show="isToolDetail"
|
||||
class="tool-detail-wrapper"
|
||||
>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -49,13 +62,43 @@ import {
|
||||
NCollapse, NCollapseItem, NEllipsis,
|
||||
} from 'naive-ui';
|
||||
|
||||
import {
|
||||
computed,
|
||||
} from 'vue';
|
||||
|
||||
import {
|
||||
useRoute, useRouter,
|
||||
} from 'vue-router';
|
||||
|
||||
import {
|
||||
toolList,
|
||||
} from '@/assets/js/toolbox-data';
|
||||
|
||||
import {
|
||||
TOOLBOX_MODULE_TITLE,
|
||||
} from '@/config/modules';
|
||||
/** 是否为工具页面 */
|
||||
const isToolDetail = computed(() => {
|
||||
return route.meta.isToolDetail;
|
||||
});
|
||||
|
||||
/** 路由 */
|
||||
const route = useRoute();
|
||||
|
||||
/** 路由 */
|
||||
const router = useRouter();
|
||||
|
||||
/** 页面标题 */
|
||||
const routeTitle = computed(() => {
|
||||
return route.meta.title;
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 打开工具
|
||||
* @param {ToolboxItem} data
|
||||
*/
|
||||
function handleOpenTool(data) {
|
||||
router.push({
|
||||
name: `Toolbox/${data.component}`,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@@ -100,4 +143,13 @@ import {
|
||||
opacity: 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
.tool-detail-wrapper {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #FFF;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user