template中增加了debugPanel
This commit is contained in:
parent
3cc18023ec
commit
2f8535fd8b
|
|
@ -112,7 +112,8 @@ function findLocaleFiles(json, path, name = '', buildPath, nodeEnv, platform) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function listenerLocaleFiles(path, buildPath, nodeEnv, platform) {
|
function listenerLocaleFiles(path, buildPath, nodeEnv, platform) {
|
||||||
fs.watch(path, { recursive: true }, (eventType, filename) => {
|
// todo linux下不支持recursive监控,以后再说
|
||||||
|
fs.watch(path, process.platform !== 'linux' ? { recursive: true } : {}, (eventType, filename) => {
|
||||||
const fPath = Path.resolve(path, filename).replace(/\\/g, '/');
|
const fPath = Path.resolve(path, filename).replace(/\\/g, '/');
|
||||||
console.log('\nThe file', fPath, 'was modified!');
|
console.log('\nThe file', fPath, 'was modified!');
|
||||||
console.log('The type of change was:', eventType);
|
console.log('The type of change was:', eventType);
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Routes, Route } from 'react-router-dom';
|
import { Routes, Route } from 'react-router-dom';
|
||||||
|
import { Button, Drawer } from 'tdesign-react';
|
||||||
|
import { ChevronUpIcon } from 'tdesign-icons-react'
|
||||||
|
|
||||||
import './App.less';
|
import './App.less';
|
||||||
import LazyLoad from './utils/lazyLoad';
|
import LazyLoad from './utils/lazyLoad';
|
||||||
const Console = LazyLoad(() => import('./template/console'));
|
const Console = LazyLoad(() => import('./template/console'));
|
||||||
const Frontend = LazyLoad(() => import('./template/frontend'));
|
const Frontend = LazyLoad(() => import('./template/frontend'));
|
||||||
const NotFound = LazyLoad(() => import('./template/notFound'));
|
const NotFound = LazyLoad(() => import('./template/notFound'));
|
||||||
const Message = LazyLoad(() =>import('@oak-general-business/components/message'));
|
const Message = LazyLoad(() => import('@oak-general-business/components/message'));
|
||||||
|
const DebugPanel = LazyLoad(() => import('@oak-general-business/components/Func/debugPanel'));
|
||||||
|
|
||||||
type Router = {
|
type Router = {
|
||||||
path: string;
|
path: string;
|
||||||
|
|
@ -30,6 +33,14 @@ function getRoutes(routers2: Router[], namespace?: string) {
|
||||||
let routers: Router[] = [];
|
let routers: Router[] = [];
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
|
const handleClick = () => {
|
||||||
|
setVisible(true);
|
||||||
|
};
|
||||||
|
const handleClose = () => {
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{Message}
|
{Message}
|
||||||
|
|
@ -42,6 +53,34 @@ function App() {
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="*" element={NotFound} />
|
<Route path="*" element={NotFound} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
{
|
||||||
|
process.env.NODE_ENV === "development" && (
|
||||||
|
<React.Fragment>
|
||||||
|
<Button
|
||||||
|
variant="text"
|
||||||
|
shape="circle"
|
||||||
|
theme="primary"
|
||||||
|
icon={<ChevronUpIcon />}
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 0,
|
||||||
|
right: '45vw',
|
||||||
|
}}
|
||||||
|
onClick={handleClick}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Drawer
|
||||||
|
placement="bottom"
|
||||||
|
visible={visible}
|
||||||
|
onClose={handleClose}
|
||||||
|
header={<text>debug控制台</text>}
|
||||||
|
footer={<div/>}
|
||||||
|
>
|
||||||
|
{DebugPanel}
|
||||||
|
</Drawer>
|
||||||
|
</React.Fragment>
|
||||||
|
)
|
||||||
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue