Skip to content

Commit 078aba6

Browse files
authored
feat: plugin exclude routes
Feat plugin exclude routes
2 parents ea5a355 + fbba2cc commit 078aba6

File tree

27 files changed

+524
-13
lines changed

27 files changed

+524
-13
lines changed

.changeset/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@examples/aclass",
1919
"@examples/alita2",
2020
"@examples/boilerplate",
21+
"@examples/extends-app",
2122
"@examples/helmet",
2223
"@examples/state",
2324
"@examples/legacy",

.changeset/smart-apes-cheat.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@alita/plugin-extends-app': patch
3+
'@alita/plugins': patch
4+
'alita': patch
5+
---
6+
7+
feat: add plugin extends app

examples/extends-app/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.env.local
2+
/.umirc.local.ts
3+
/.umirc.local.js
4+
/config/config.local.ts
5+
/config/config.local.js
6+
/src/.umi
7+
/.umi

examples/extends-app/config/config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { defineConfig } from 'alita';
2+
3+
export default defineConfig({
4+
appType: 'h5',
5+
keepalive: [/./],
6+
extendsApp: {
7+
root: 'root',
8+
},
9+
plugins: ['@alita/plugin-extends-app'],
10+
mobileLayout: true,
11+
legacyBuild: false,
12+
// mainPath:'users',
13+
mfsu: {},
14+
hash: false,
15+
});

examples/extends-app/mock/app.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
'/api/hello': {
3+
text: 'Alita',
4+
},
5+
};

examples/extends-app/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "@examples/extends-app",
3+
"private": true,
4+
"scripts": {
5+
"dev": "alita dev",
6+
"build": "alita build",
7+
"plugin": "alita plugin list",
8+
"start": "npm run dev"
9+
},
10+
"dependencies": {
11+
"@alita/flow": "workspace:*",
12+
"@alita/plugin-extends-app": "workspace:*",
13+
"ahooks": "^3.0.8",
14+
"alita": "workspace:*",
15+
"antd-mobile": "^5.10.0"
16+
}
17+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.title {
2+
font-size: 30px;
3+
}
4+
.adm-button{
5+
font-size: 30px
6+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Button } from 'antd-mobile';
2+
import React, { useState } from 'react';
3+
import styles from './index.less';
4+
export default () => {
5+
const [count, setCount] = useState(0);
6+
return (
7+
<div className={styles['adm-button']}>
8+
exclude routes hello
9+
<Button
10+
type="button"
11+
color="primary"
12+
fill="solid"
13+
block
14+
size="large"
15+
onClick={() => setCount(count + 1)}
16+
>
17+
点我计数加1 {count}
18+
</Button>
19+
</div>
20+
);
21+
};

examples/extends-app/src/app.tsx

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import HomeGary from '@/assets/demoIcon/home.png';
2+
import HomeBlue from '@/assets/demoIcon/home1.png';
3+
import ListGary from '@/assets/demoIcon/list.png';
4+
import ListBlue from '@/assets/demoIcon/list1.png';
5+
import type {
6+
NavBarListItem,
7+
NavBarProps,
8+
TabBarListItem,
9+
TabBarProps,
10+
TitleListItem,
11+
} from 'alita';
12+
13+
export const request = {
14+
prefix: '/api',
15+
method: 'get',
16+
errorHandler: (error) => {
17+
// 集中处理错误
18+
console.log(11111111);
19+
console.log(error);
20+
},
21+
};
22+
23+
const titleList: TitleListItem[] = [
24+
{
25+
pagePath: '/',
26+
title: '首页',
27+
},
28+
{
29+
pagePath: '/hello',
30+
title: 'Hi',
31+
},
32+
];
33+
const navList: NavBarListItem[] = [
34+
{
35+
pagePath: '/',
36+
navBar: {
37+
pageBackground: '#fff',
38+
},
39+
},
40+
{
41+
pagePath: '/hello',
42+
navBar: {
43+
pageBackground: '#e5e5e5',
44+
},
45+
},
46+
];
47+
const navBar: NavBarProps = {
48+
navList,
49+
fixed: false,
50+
onLeftClick: () => {
51+
// router.goBack();
52+
},
53+
};
54+
const tabList: TabBarListItem[] = [
55+
{
56+
pagePath: '/',
57+
text: '首页',
58+
iconPath: HomeGary,
59+
selectedIconPath: HomeBlue,
60+
title: '首页',
61+
iconSize: '',
62+
badge: '',
63+
},
64+
{
65+
pagePath: '/hello',
66+
text: 'Hi',
67+
iconPath: ListGary,
68+
selectedIconPath: ListBlue,
69+
title: 'Hi',
70+
iconSize: '',
71+
badge: '',
72+
},
73+
];
74+
75+
const tabBar: TabBarProps = {
76+
color: `#999999`,
77+
selectedColor: '#00A0FF',
78+
borderStyle: 'white',
79+
position: 'bottom',
80+
list: tabList,
81+
};
82+
83+
export const mobileLayout = {
84+
documentTitle: '默认标题',
85+
navBar,
86+
tabBar,
87+
titleList,
88+
};
667 Bytes
Loading

0 commit comments

Comments
 (0)