feat(页面布局): 调整头部菜单的路由控制,删除dist目录
This commit is contained in:
parent
57d766fab0
commit
206de9e618
|
@ -1,182 +1,182 @@
|
|||
import { app, shell, BrowserWindow, ipcMain, globalShortcut, dialog } from 'electron'
|
||||
import { join } from 'path'
|
||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||
import icon from '../../resources/icon.png?asset'
|
||||
import { app, shell, BrowserWindow, ipcMain, globalShortcut, dialog } from 'electron';
|
||||
import { join } from 'path';
|
||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils';
|
||||
import icon from '../../resources/icon.png?asset';
|
||||
|
||||
//关闭exe命令
|
||||
function killProcessByName(processName) {
|
||||
const command = `taskkill /IM ${processName} /F`
|
||||
const { exec } = require('child_process')
|
||||
const command = `taskkill /IM ${processName} /F`;
|
||||
const { exec } = require('child_process');
|
||||
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error(`执行的错误: ${error}`)
|
||||
return
|
||||
}
|
||||
console.log(`stdout: ${stdout}`)
|
||||
console.error(`stderr: ${stderr}`)
|
||||
})
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error(`执行的错误: ${error}`);
|
||||
return;
|
||||
}
|
||||
console.log(`stdout: ${stdout}`);
|
||||
console.error(`stderr: ${stderr}`);
|
||||
});
|
||||
}
|
||||
|
||||
app.commandLine.appendSwitch('disable-web-security')
|
||||
app.commandLine.appendSwitch('disable-web-security');
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 1100,
|
||||
height: 700,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
icon,
|
||||
webPreferences: {
|
||||
preload: join(__dirname, '../preload/index.js'),
|
||||
sandbox: false,
|
||||
nodeIntegration: true,
|
||||
// 禁用同源策略,允许跨域请求
|
||||
webSecurity: false,
|
||||
contextIsolation: false,
|
||||
csp: "default-src 'self'; connect-src 'self' *",
|
||||
// 禁止build环境使用DevTool
|
||||
// devTools: is.dev ? true : false
|
||||
devTools: true
|
||||
}
|
||||
})
|
||||
//开启调试
|
||||
// mainWindow.webContents.openDevTools()
|
||||
mainWindow.on('ready-to-show', () => {
|
||||
mainWindow.show()
|
||||
})
|
||||
// Create the browser window.
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 1100,
|
||||
height: 700,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
icon,
|
||||
webPreferences: {
|
||||
preload: join(__dirname, '../preload/index.js'),
|
||||
sandbox: false,
|
||||
nodeIntegration: true,
|
||||
// 禁用同源策略,允许跨域请求
|
||||
webSecurity: false,
|
||||
contextIsolation: false,
|
||||
csp: "default-src 'self'; connect-src 'self' *",
|
||||
// 禁止build环境使用DevTool
|
||||
// devTools: is.dev ? true : false
|
||||
devTools: true
|
||||
}
|
||||
});
|
||||
//开启调试
|
||||
// mainWindow.webContents.openDevTools()
|
||||
mainWindow.on('ready-to-show', () => {
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||
shell.openExternal(details.url)
|
||||
return { action: 'deny' }
|
||||
})
|
||||
// HMR for renderer base on electron-vite cli.
|
||||
// Load the remote URL for development or the local html file for production.
|
||||
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
||||
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
|
||||
} else {
|
||||
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
|
||||
}
|
||||
mainWindow.webContents.setWindowOpenHandler(details => {
|
||||
shell.openExternal(details.url);
|
||||
return { action: 'deny' };
|
||||
});
|
||||
// HMR for renderer base on electron-vite cli.
|
||||
// Load the remote URL for development or the local html file for production.
|
||||
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
|
||||
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']);
|
||||
} else {
|
||||
mainWindow.loadFile(join(__dirname, '../renderer/index.html'));
|
||||
}
|
||||
|
||||
// 设置DevTools快捷键
|
||||
// 设置DevTools快捷键
|
||||
globalShortcut.register('CommandOrControl+Shift+i', function () {
|
||||
mainWindow.webContents.openDevTools()
|
||||
})
|
||||
return mainWindow
|
||||
// 设置DevTools快捷键
|
||||
// 设置DevTools快捷键
|
||||
globalShortcut.register('CommandOrControl+Shift+i', function () {
|
||||
mainWindow.webContents.openDevTools();
|
||||
});
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
// 程序单例模式
|
||||
let myWindow = null
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
let myWindow = null;
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
if (!gotTheLock) {
|
||||
// 如果已经有同样的该程序正在运行,则不启动
|
||||
app.quit()
|
||||
// 如果已经有同样的该程序正在运行,则不启动
|
||||
app.quit();
|
||||
} else {
|
||||
// 如果检测到有同样的该程序正在试图启动...
|
||||
app.on('second-instance', () => {
|
||||
if (myWindow) {
|
||||
// 弹出系统提示对话框
|
||||
dialog.showMessageBox({
|
||||
message: '此程序已经正在运行'
|
||||
})
|
||||
// 如果该程序窗口处于最小化状态,则恢复窗口
|
||||
if (myWindow.isMinimized()) myWindow.restore()
|
||||
// 将该程序窗口置为当前聚焦态
|
||||
myWindow.focus()
|
||||
}
|
||||
})
|
||||
// 如果检测到有同样的该程序正在试图启动...
|
||||
app.on('second-instance', () => {
|
||||
if (myWindow) {
|
||||
// 弹出系统提示对话框
|
||||
dialog.showMessageBox({
|
||||
message: '此程序已经正在运行'
|
||||
});
|
||||
// 如果该程序窗口处于最小化状态,则恢复窗口
|
||||
if (myWindow.isMinimized()) myWindow.restore();
|
||||
// 将该程序窗口置为当前聚焦态
|
||||
myWindow.focus();
|
||||
}
|
||||
});
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
const { spawn } = require('child_process')
|
||||
let child = null
|
||||
let exePluginsExeList = []
|
||||
app.whenReady().then(() => {
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
const { spawn } = require('child_process');
|
||||
let child = null;
|
||||
let exePluginsExeList = [];
|
||||
app.whenReady().then(() => {
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const logStream = fs.createWriteStream('app.log', { flags: 'a' }) // 日志文件
|
||||
let exePath = path.resolve('./resources/app.asar.unpacked/resources/service')
|
||||
let exePluginsPath = path.resolve('./resources/app.asar.unpacked/resources/service/plugins')
|
||||
//单独配置测试环境
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
exePath = path.resolve('./resources/service')
|
||||
exePluginsPath = path.resolve('./resources/service/plugins')
|
||||
}
|
||||
const logStream = fs.createWriteStream('app.log', { flags: 'a' }); // 日志文件
|
||||
let exePath = path.resolve('./resources/app.asar.unpacked/resources/service');
|
||||
let exePluginsPath = path.resolve('./resources/app.asar.unpacked/resources/service/plugins');
|
||||
//单独配置测试环境
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
exePath = path.resolve('./resources/service');
|
||||
exePluginsPath = path.resolve('./resources/service/plugins');
|
||||
}
|
||||
|
||||
//查询所有插件目录下的exe文件
|
||||
fs.readdir(exePluginsPath, (err, files) => {
|
||||
if (err) {
|
||||
return console.log('Unable to scan directory: ' + err)
|
||||
}
|
||||
// 筛选出以.exe结尾的文件
|
||||
exePluginsExeList = files.filter((file) => path.extname(file).toLowerCase() === '.exe')
|
||||
})
|
||||
//查询所有插件目录下的exe文件
|
||||
fs.readdir(exePluginsPath, (err, files) => {
|
||||
if (err) {
|
||||
return console.log('Unable to scan directory: ' + err);
|
||||
}
|
||||
// 筛选出以.exe结尾的文件
|
||||
exePluginsExeList = files.filter(file => path.extname(file).toLowerCase() === '.exe');
|
||||
});
|
||||
|
||||
child = spawn('./main.exe', [], { cwd: exePath, stdio: ['ignore', 'pipe', 'pipe'] })
|
||||
child = spawn('./main.exe', [], { cwd: exePath, stdio: ['ignore', 'pipe', 'pipe'] });
|
||||
|
||||
//监听进程的输出
|
||||
child.stdout.on('data', (data) => {
|
||||
console.log('stdout:', data.toString())
|
||||
logStream.write(data)
|
||||
})
|
||||
//监听进程的输出
|
||||
child.stdout.on('data', data => {
|
||||
console.log('stdout:', data.toString());
|
||||
logStream.write(data);
|
||||
});
|
||||
|
||||
child.stderr.on('data', (data) => {
|
||||
console.error('stderr:', data.toString())
|
||||
logStream.write(data)
|
||||
})
|
||||
child.stderr.on('data', data => {
|
||||
console.error('stderr:', data.toString());
|
||||
logStream.write(data);
|
||||
});
|
||||
|
||||
child.on('close', (code) => {
|
||||
console.log(`子进程已退出,退出码 ${code}`)
|
||||
logStream.end()
|
||||
})
|
||||
child.on('close', code => {
|
||||
console.log(`子进程已退出,退出码 ${code}`);
|
||||
logStream.end();
|
||||
});
|
||||
|
||||
child.on('exit', (code, signal) => {
|
||||
console.log(`子进程已退出,退出码 ${code},信号: ${signal}`)
|
||||
logStream.write(`子进程已退出,退出码 ${code},信号: ${signal}`)
|
||||
logStream.end()
|
||||
})
|
||||
child.on('exit', (code, signal) => {
|
||||
console.log(`子进程已退出,退出码 ${code},信号: ${signal}`);
|
||||
logStream.write(`子进程已退出,退出码 ${code},信号: ${signal}`);
|
||||
logStream.end();
|
||||
});
|
||||
|
||||
// Set app user model id for windows
|
||||
electronApp.setAppUserModelId('com.electron')
|
||||
// Set app user model id for windows
|
||||
electronApp.setAppUserModelId('com.electron');
|
||||
|
||||
// Default open or close DevTools by F12 in development
|
||||
// and ignore CommandOrControl + R in production.
|
||||
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
|
||||
app.on('browser-window-created', (_, window) => {
|
||||
optimizer.watchWindowShortcuts(window)
|
||||
})
|
||||
// Default open or close DevTools by F12 in development
|
||||
// and ignore CommandOrControl + R in production.
|
||||
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
|
||||
app.on('browser-window-created', (_, window) => {
|
||||
optimizer.watchWindowShortcuts(window);
|
||||
});
|
||||
|
||||
// IPC test
|
||||
ipcMain.on('ping', () => console.log('pong'))
|
||||
// IPC test
|
||||
ipcMain.on('ping', () => console.log('pong'));
|
||||
|
||||
myWindow = createWindow()
|
||||
myWindow = createWindow();
|
||||
|
||||
app.on('activate', function () {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
})
|
||||
app.on('activate', function () {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
||||
});
|
||||
});
|
||||
|
||||
// Quit when all windows are closed, except on macOS. There, it's common
|
||||
// for applications and their menu bar to stay active until the user quits
|
||||
// explicitly with Cmd + Q.
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
// 循环关闭插件 EXE 列表
|
||||
exePluginsExeList.forEach((exe) => {
|
||||
killProcessByName(exe)
|
||||
})
|
||||
// child.kill('SIGTERM'); // 或者使用 'SIGKILL' 来强制关闭
|
||||
// killProcessByName('gateway.exe');
|
||||
// 循环关闭后端服务
|
||||
killProcessByName('main.exe')
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
// Quit when all windows are closed, except on macOS. There, it's common
|
||||
// for applications and their menu bar to stay active until the user quits
|
||||
// explicitly with Cmd + Q.
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
// 循环关闭插件 EXE 列表
|
||||
exePluginsExeList.forEach(exe => {
|
||||
killProcessByName(exe);
|
||||
});
|
||||
// child.kill('SIGTERM'); // 或者使用 'SIGKILL' 来强制关闭
|
||||
// killProcessByName('gateway.exe');
|
||||
// 循环关闭后端服务
|
||||
killProcessByName('main.exe');
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
}
|
||||
// In this file you can include the rest of your app"s specific main process
|
||||
// code. You can also put them in separate files and require them here.
|
||||
|
|
|
@ -1,71 +1,63 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const settings = defineProps({
|
||||
collapse: Boolean,
|
||||
width: String
|
||||
})
|
||||
|
||||
|
||||
collapse: Boolean,
|
||||
width: String
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-aside :width="settings.width">
|
||||
<el-scrollbar>
|
||||
<el-menu
|
||||
default-active="/system/switch"
|
||||
:collapse="settings.collapse"
|
||||
:router="true"
|
||||
>
|
||||
<el-menu-item index="/system/switch"> <span class="iconfont icon-icon_duanluqi"></span> 断路器调试</el-menu-item>
|
||||
<!-- <el-menu-item index="/system/about"><span class="iconfont icon-icon_jiankong"></span> 视频监控</el-menu-item>-->
|
||||
<!-- <el-menu-item index="/test"><el-icon> <Menu /> </el-icon>测试</el-menu-item>-->
|
||||
</el-menu>
|
||||
</el-scrollbar>
|
||||
</el-aside>
|
||||
<el-aside :width="settings.width">
|
||||
<el-scrollbar>
|
||||
<el-menu default-active="/system/switch" :collapse="settings.collapse" :router="true">
|
||||
<el-menu-item index="/system/switch"> <span class="iconfont icon-icon_duanluqi"></span> 断路器调试</el-menu-item>
|
||||
<!-- <el-menu-item index="/system/about"><span class="iconfont icon-icon_jiankong"></span> 视频监控</el-menu-item>-->
|
||||
<!-- <el-menu-item index="/system/test"><el-icon> <Menu /> </el-icon>测试</el-menu-item>-->
|
||||
</el-menu>
|
||||
</el-scrollbar>
|
||||
</el-aside>
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
.el-aside {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
.el-menu{
|
||||
padding: 0 10px;
|
||||
background: #fff;
|
||||
.el-menu {
|
||||
padding: 0 10px;
|
||||
background: #fff;
|
||||
}
|
||||
.el-menu-item{
|
||||
border-radius: 10px;
|
||||
background: #f2f2f2;
|
||||
margin-bottom: 12px;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
padding-left: 26px !important;
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
.iconfont{
|
||||
margin-right: 10px;
|
||||
color: #999;
|
||||
font-size: 22px;
|
||||
}
|
||||
.el-menu-item {
|
||||
border-radius: 10px;
|
||||
background: #f2f2f2;
|
||||
margin-bottom: 12px;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
padding-left: 26px !important;
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
.iconfont {
|
||||
margin-right: 10px;
|
||||
color: #999;
|
||||
font-size: 22px;
|
||||
}
|
||||
}
|
||||
.el-menu-item.is-active{
|
||||
background: #4c94db;
|
||||
border-radius: 10px;
|
||||
/*margin: 0 10px;*/
|
||||
color: #fff;
|
||||
.iconfont{
|
||||
color: #fff;
|
||||
}
|
||||
.el-menu-item.is-active {
|
||||
background: #4c94db;
|
||||
border-radius: 10px;
|
||||
/*margin: 0 10px;*/
|
||||
color: #fff;
|
||||
.iconfont {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.el-scrollbar {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
/*background-color: #1a1c1e;*/
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
/*background-color: #1a1c1e;*/
|
||||
}
|
||||
|
||||
.el-menu {
|
||||
border-right: none;
|
||||
border-right: none;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
router="true"
|
||||
>
|
||||
<el-menu-item index="/system">系统模板</el-menu-item>
|
||||
<!-- <el-menu-item index="/test">测试</el-menu-item>-->
|
||||
</el-menu>
|
||||
</div>
|
||||
<div class="haeder-right">
|
||||
|
|
|
@ -1,41 +1,35 @@
|
|||
|
||||
<template>
|
||||
<el-container direction="vertical" style="min-height: 100vh;min-width: 100vw;overflow: hidden;">
|
||||
<Header></Header>
|
||||
<el-container style="padding: 10px 0">
|
||||
<Aside width="180px"></Aside>
|
||||
<el-main>
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive>
|
||||
<component :is="Component" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
<el-container direction="vertical" style="min-height: 100vh; min-width: 100vw; overflow: hidden">
|
||||
<Header></Header>
|
||||
<el-main>
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive>
|
||||
<component :is="Component" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// 组件注册
|
||||
import Header from '@renderer/layout/Header.vue'
|
||||
import Aside from '@renderer/layout/Aside.vue'
|
||||
import Header from '@renderer/layout/Header.vue';
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
body{
|
||||
background-color: #eee;
|
||||
max-width: 100vw;
|
||||
}
|
||||
.el-container{
|
||||
/*padding: 10px 0;*/
|
||||
}
|
||||
.el-main {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
overflow-x: hidden;
|
||||
background: #fff;
|
||||
padding-right: 10px;
|
||||
}
|
||||
body {
|
||||
background-color: #eee;
|
||||
max-width: 100vw;
|
||||
}
|
||||
.el-container {
|
||||
/*padding: 10px 0;*/
|
||||
}
|
||||
.el-main {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
overflow-x: hidden;
|
||||
background: #fff;
|
||||
padding-right: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,51 +1,59 @@
|
|||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import Layout from '@renderer/layout/index.vue'
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import Layout from '@renderer/layout/index.vue';
|
||||
import systenLayout from '@renderer/views/system/index.vue';
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/system',
|
||||
name: 'system',
|
||||
component: Layout,
|
||||
redirect: {name: 'switch'},
|
||||
children:[
|
||||
{
|
||||
path: 'switch',
|
||||
name: 'switch',
|
||||
component: () => import("@renderer/views/switch/index.vue"),
|
||||
meta: {
|
||||
menu: 'switch',
|
||||
keepAlive: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'about',
|
||||
name: 'about',
|
||||
component: () => import("@renderer/views/AboutView.vue"),
|
||||
meta: {
|
||||
menu: 'about',
|
||||
keepAlive: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'test',
|
||||
name: 'test',
|
||||
component: () => import("@renderer/views/test.vue"),
|
||||
meta: {
|
||||
menu: 'test',
|
||||
keepAlive: true,
|
||||
}
|
||||
},
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
meta: { title: '整体页面布局' },
|
||||
redirect: '/system',
|
||||
children: [
|
||||
{
|
||||
path: '/system',
|
||||
name: 'system',
|
||||
component: systenLayout,
|
||||
redirect: { name: 'switch' },
|
||||
children: [
|
||||
{
|
||||
path: 'switch',
|
||||
name: 'switch',
|
||||
component: () => import('@renderer/views/system/switch/index.vue'),
|
||||
meta: {
|
||||
menu: 'switch',
|
||||
keepAlive: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'about',
|
||||
name: 'about',
|
||||
component: () => import('@renderer/views/AboutView.vue'),
|
||||
meta: {
|
||||
menu: 'about',
|
||||
keepAlive: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'test',
|
||||
name: 'test',
|
||||
component: () => import('@renderer/views/test.vue'),
|
||||
meta: {
|
||||
menu: 'test',
|
||||
keepAlive: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/', // 这个是根路由,现在我们让它重定向到 /system
|
||||
redirect: '/system'
|
||||
},
|
||||
{ path: '/:pathMatch(.*)', redirect: '/' }
|
||||
]
|
||||
});
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/', // 这个是根路由,现在我们让它重定向到 /system
|
||||
redirect: '/system',
|
||||
},
|
||||
{ path: '/:pathMatch(.*)', redirect: '/' },
|
||||
]
|
||||
})
|
||||
|
||||
export default router
|
||||
export default router;
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<script setup>
|
||||
// 组件注册
|
||||
import Header from '@renderer/components/Header.vue'
|
||||
import Aside from '@renderer/components/Aside.vue'
|
||||
</script>
|
||||
<template>
|
||||
<el-container direction="vertical" style="min-height: 100vh;min-width: 100vw;overflow: hidden;">
|
||||
<Header></Header>
|
||||
<el-container >
|
||||
<Aside width="160px"></Aside>
|
||||
<el-main>
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive>
|
||||
<component :is="Component" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
<style scoped>
|
||||
|
||||
body{
|
||||
background-color: #eee;
|
||||
max-width: 100vw;
|
||||
}
|
||||
|
||||
.el-main {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
overflow-x: hidden;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<el-container style="padding: 10px 0">
|
||||
<Aside width="180px"></Aside>
|
||||
<el-main>
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive>
|
||||
<component :is="Component" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// 组件注册
|
||||
import Aside from '@renderer/layout/Aside.vue';
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
body {
|
||||
background-color: #eee;
|
||||
max-width: 100vw;
|
||||
}
|
||||
.el-container {
|
||||
/*padding: 10px 0;*/
|
||||
}
|
||||
.el-main {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
overflow-x: hidden;
|
||||
background: #fff;
|
||||
padding-right: 10px;
|
||||
}
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue