-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat plugin exclude routes
- Loading branch information
Showing
27 changed files
with
524 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@alita/plugin-extends-app': patch | ||
'@alita/plugins': patch | ||
'alita': patch | ||
--- | ||
|
||
feat: add plugin extends app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/.env.local | ||
/.umirc.local.ts | ||
/.umirc.local.js | ||
/config/config.local.ts | ||
/config/config.local.js | ||
/src/.umi | ||
/.umi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { defineConfig } from 'alita'; | ||
|
||
export default defineConfig({ | ||
appType: 'h5', | ||
keepalive: [/./], | ||
extendsApp: { | ||
root: 'root', | ||
}, | ||
plugins: ['@alita/plugin-extends-app'], | ||
mobileLayout: true, | ||
legacyBuild: false, | ||
// mainPath:'users', | ||
mfsu: {}, | ||
hash: false, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
'/api/hello': { | ||
text: 'Alita', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "@examples/extends-app", | ||
"private": true, | ||
"scripts": { | ||
"dev": "alita dev", | ||
"build": "alita build", | ||
"plugin": "alita plugin list", | ||
"start": "npm run dev" | ||
}, | ||
"dependencies": { | ||
"@alita/flow": "workspace:*", | ||
"@alita/plugin-extends-app": "workspace:*", | ||
"ahooks": "^3.0.8", | ||
"alita": "workspace:*", | ||
"antd-mobile": "^5.10.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.title { | ||
font-size: 30px; | ||
} | ||
.adm-button{ | ||
font-size: 30px | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Button } from 'antd-mobile'; | ||
import React, { useState } from 'react'; | ||
import styles from './index.less'; | ||
export default () => { | ||
const [count, setCount] = useState(0); | ||
return ( | ||
<div className={styles['adm-button']}> | ||
exclude routes hello | ||
<Button | ||
type="button" | ||
color="primary" | ||
fill="solid" | ||
block | ||
size="large" | ||
onClick={() => setCount(count + 1)} | ||
> | ||
点我计数加1 {count} | ||
</Button> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import HomeGary from '@/assets/demoIcon/home.png'; | ||
import HomeBlue from '@/assets/demoIcon/home1.png'; | ||
import ListGary from '@/assets/demoIcon/list.png'; | ||
import ListBlue from '@/assets/demoIcon/list1.png'; | ||
import type { | ||
NavBarListItem, | ||
NavBarProps, | ||
TabBarListItem, | ||
TabBarProps, | ||
TitleListItem, | ||
} from 'alita'; | ||
|
||
export const request = { | ||
prefix: '/api', | ||
method: 'get', | ||
errorHandler: (error) => { | ||
// 集中处理错误 | ||
console.log(11111111); | ||
console.log(error); | ||
}, | ||
}; | ||
|
||
const titleList: TitleListItem[] = [ | ||
{ | ||
pagePath: '/', | ||
title: '首页', | ||
}, | ||
{ | ||
pagePath: '/hello', | ||
title: 'Hi', | ||
}, | ||
]; | ||
const navList: NavBarListItem[] = [ | ||
{ | ||
pagePath: '/', | ||
navBar: { | ||
pageBackground: '#fff', | ||
}, | ||
}, | ||
{ | ||
pagePath: '/hello', | ||
navBar: { | ||
pageBackground: '#e5e5e5', | ||
}, | ||
}, | ||
]; | ||
const navBar: NavBarProps = { | ||
navList, | ||
fixed: false, | ||
onLeftClick: () => { | ||
// router.goBack(); | ||
}, | ||
}; | ||
const tabList: TabBarListItem[] = [ | ||
{ | ||
pagePath: '/', | ||
text: '首页', | ||
iconPath: HomeGary, | ||
selectedIconPath: HomeBlue, | ||
title: '首页', | ||
iconSize: '', | ||
badge: '', | ||
}, | ||
{ | ||
pagePath: '/hello', | ||
text: 'Hi', | ||
iconPath: ListGary, | ||
selectedIconPath: ListBlue, | ||
title: 'Hi', | ||
iconSize: '', | ||
badge: '', | ||
}, | ||
]; | ||
|
||
const tabBar: TabBarProps = { | ||
color: `#999999`, | ||
selectedColor: '#00A0FF', | ||
borderStyle: 'white', | ||
position: 'bottom', | ||
list: tabList, | ||
}; | ||
|
||
export const mobileLayout = { | ||
documentTitle: '默认标题', | ||
navBar, | ||
tabBar, | ||
titleList, | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { query } from '@/services/api'; | ||
import type { DvaModel } from 'alita'; | ||
|
||
export interface IndexModelState { | ||
name: string; | ||
} | ||
|
||
const IndexModel: DvaModel<IndexModelState> = { | ||
namespace: 'index', | ||
|
||
state: { | ||
name: 'Hello Alita', | ||
}, | ||
|
||
effects: { | ||
*query({ payload }, { call, put }) { | ||
const data = yield call(query, payload); | ||
yield put({ | ||
type: 'save', | ||
payload: { name: data.text }, | ||
}); | ||
}, | ||
}, | ||
reducers: { | ||
save(state, action) { | ||
return { | ||
...state, | ||
...action.payload, | ||
}; | ||
}, | ||
}, | ||
}; | ||
|
||
export default IndexModel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { useState } from 'react'; | ||
|
||
export default function () { | ||
const [todos, setTodos] = useState(['foo', 'bar']); | ||
return { | ||
todos, | ||
setTodos, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a { | ||
color: green; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.title { | ||
font-size: 30px; | ||
} | ||
.adm-button{ | ||
font-size: 30px | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Button } from 'antd-mobile'; | ||
import React, { useState } from 'react'; | ||
import styles from './index.less'; | ||
export default () => { | ||
const [count, setCount] = useState(0); | ||
return ( | ||
<div className={styles['adm-button']}> | ||
Hello Alita | ||
<Button | ||
type="button" | ||
color="primary" | ||
fill="solid" | ||
block | ||
size="large" | ||
onClick={() => setCount(count + 1)} | ||
> | ||
点我计数加1 {count} | ||
</Button> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { request } from '@@/plugin-request'; | ||
|
||
export async function query(): Promise<any> { | ||
return request('/hello'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"compileOnSave": false, | ||
"compilerOptions": { | ||
"baseUrl": "./", | ||
"outDir": "dist", | ||
"sourceMap": true, | ||
"jsx": "react", | ||
"declaration": false, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"importHelpers": true, | ||
"target": "es2017", | ||
"typeRoots": ["node_modules/@types"], | ||
"lib": ["es2018", "dom"], | ||
"allowSyntheticDefaultImports": true, | ||
"rootDirs": ["/src", "/root", "/test", "/mock", "./typings"], | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitReturns": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"noUnusedLocals": true, | ||
"allowJs": true, | ||
"strict": true, | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"@@/*": ["./src/.umi/*"], | ||
"alita": ["./src/.umi/*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
declare module '*.css'; | ||
declare module '*.less'; | ||
declare module '*.scss'; | ||
declare module '*.sass'; | ||
declare module '*.svg'; | ||
declare module '*.png'; | ||
declare module '*.jpg'; | ||
declare module '*.jpeg'; | ||
declare module '*.gif'; | ||
declare module '*.bmp'; | ||
declare module '*.tiff'; | ||
declare module '*.json'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @alita/plugin-exclude-pages | ||
|
||
See our website [alitajs](https://alitajs.com) for more information. |
Oops, something went wrong.