2021-04-06 20:50:42 +08:00
|
|
|
<template>
|
2021-11-14 16:28:03 +08:00
|
|
|
<div class="tools-detail">
|
|
|
|
<component :is="toolPage" />
|
|
|
|
</div>
|
2021-04-06 20:50:42 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-05-09 14:27:52 +08:00
|
|
|
import navTools from '@/assets/js/navTools.js';
|
|
|
|
|
2021-04-06 20:50:42 +08:00
|
|
|
export default {
|
2021-11-14 16:28:03 +08:00
|
|
|
name: 'ToolsDetail',
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
next(vm => {
|
|
|
|
const { params, query } = vm.$route;
|
|
|
|
const { category: cCategory, name: cName } = params;
|
|
|
|
const componentName = vm.toolList[cCategory]['list'][cName].component;
|
2021-05-03 00:56:11 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
var loading = null;
|
2021-05-03 00:56:11 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
console.log('[打开工具]', { params, query });
|
2021-05-05 19:22:08 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
// 异步,防止找不到 target
|
|
|
|
setTimeout(() => {
|
|
|
|
// 开启 Loading
|
|
|
|
loading = vm.$loading({
|
|
|
|
background: '#FFF',
|
|
|
|
lock: true,
|
|
|
|
// Loading 需要覆盖的 DOM 节点
|
|
|
|
target: '.drawer-full .el-drawer__body'
|
|
|
|
});
|
|
|
|
}, 0);
|
2021-05-03 00:56:11 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
vm.toolPage = (() => {
|
|
|
|
// 动态引入组件
|
2022-03-17 12:49:34 +08:00
|
|
|
const component = import(`@/components/Tools/${componentName}.vue`);
|
2021-05-05 19:22:08 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
Promise.all([component]).then(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
// 关闭 Loading
|
|
|
|
loading.close();
|
|
|
|
}, 200);
|
2021-04-06 20:50:42 +08:00
|
|
|
});
|
2021-11-14 16:28:03 +08:00
|
|
|
|
|
|
|
return component;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
2022-03-17 13:09:58 +08:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
utils: this.$root.utils,
|
|
|
|
toolList: navTools,
|
|
|
|
toolPage: null,
|
|
|
|
}
|
|
|
|
},
|
2021-04-06 20:50:42 +08:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
2021-05-04 00:33:16 +08:00
|
|
|
.tools-detail {
|
2021-11-14 16:28:03 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: flex-start;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
2021-05-04 00:33:16 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
/deep/ .tool-page {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 60rem;
|
2021-04-06 20:50:42 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
> div {
|
|
|
|
> .title {
|
|
|
|
position: relative;
|
|
|
|
margin: 1.5rem 0;
|
|
|
|
font-size: 1rem;
|
|
|
|
color: @textPrimary;
|
|
|
|
}
|
2021-05-04 22:02:57 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
> .title::before {
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: -0.5rem;
|
|
|
|
width: 0.2rem;
|
|
|
|
height: 100%;
|
|
|
|
background-color: @colorPrimary;
|
|
|
|
}
|
2021-05-04 22:02:57 +08:00
|
|
|
|
2021-11-14 16:28:03 +08:00
|
|
|
> .content {
|
|
|
|
line-height: 1.6em;
|
|
|
|
font-size: 0.9rem;
|
2021-05-04 00:33:16 +08:00
|
|
|
}
|
2021-11-14 16:28:03 +08:00
|
|
|
}
|
2021-05-04 00:33:16 +08:00
|
|
|
}
|
2021-04-06 20:50:42 +08:00
|
|
|
</style>
|