-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add initState and fix for mfsu
- Loading branch information
Showing
39 changed files
with
501 additions
and
323 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,8 @@ | ||
--- | ||
'alita': patch | ||
'@alita/native': patch | ||
'@alita/plugin-lowcode': patch | ||
'@alita/plugins': patch | ||
--- | ||
|
||
chore: update 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,5 @@ | ||
--- | ||
'alita': patch | ||
--- | ||
|
||
feat: add initialState |
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 @@ | ||
--- | ||
'@alita/plugins': patch | ||
--- | ||
|
||
fix: plugins no run when mfsu |
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 |
---|---|---|
|
@@ -6,7 +6,5 @@ export default { | |
}, | ||
mobileLayout: true, | ||
polyfill: 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
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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
.title { | ||
font-size: 30px; | ||
:global { | ||
.adm-button{ | ||
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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import { Button } from 'antd-mobile'; | ||
import React, { useState } from 'react'; | ||
import styles from './index.less'; | ||
export default (props) => { | ||
console.log(props); | ||
export default () => { | ||
const [count, setCount] = useState(0); | ||
return ( | ||
<div className={styles['adm-button']}> | ||
Hello 123 | ||
{Math.random()} | ||
<Button | ||
type="button" | ||
color="primary" | ||
fill="solid" | ||
block | ||
size="large" | ||
onClick={() => setCount(count + 1)} | ||
> | ||
点我计数加1134 {count} | ||
</Button> | ||
</div> | ||
<> | ||
<div className={styles['adm-button']}>antd mobile</div> | ||
<div className={styles['title']}> | ||
Hello 123 | ||
{Math.random()} | ||
<Button | ||
type="button" | ||
color="primary" | ||
fill="solid" | ||
block | ||
size="large" | ||
onClick={() => setCount(count + 1)} | ||
> | ||
点我计数加1134 {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 { defineConfig } from 'alita'; | ||
|
||
export default defineConfig({ | ||
initialState: {}, | ||
}); |
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,12 @@ | ||
{ | ||
"name": "@examples/state", | ||
"private": true, | ||
"scripts": { | ||
"dev": "alita dev", | ||
"build": "ANALYZE=1 alita build", | ||
"start": "npm run dev" | ||
}, | ||
"dependencies": { | ||
"alita": "3.2.6" | ||
} | ||
} |
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,26 @@ | ||
import { query } from '@/services/api'; | ||
|
||
const middleware = async (ctx, next: () => void) => { | ||
console.log(ctx); | ||
// 可以在这写一些请求前做的事情 操作ctx.req | ||
await next(); | ||
|
||
// 可以在这里对响应数据做一些操作 操作ctx.res | ||
}; | ||
|
||
export const request = { | ||
prefix: '/api', | ||
method: 'get', | ||
middlewares: [middleware], | ||
errorHandler: (error) => { | ||
// 集中处理错误 | ||
console.log(11111111); | ||
console.log(error); | ||
}, | ||
}; | ||
|
||
export async function getInitialState() { | ||
const initialData = await query(); | ||
console.log(initialData); | ||
return initialData; | ||
} |
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 @@ | ||
import { useModel } from 'alita'; | ||
|
||
export default () => { | ||
const { initialState, loading, error, refresh, setInitialState } = | ||
useModel('@@initialState'); | ||
return <>{JSON.stringify(initialState)}</>; | ||
}; |
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,3 @@ | ||
{ | ||
"extends": "./src/.umi/tsconfig.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import 'umi/typings'; |
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
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
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 |
---|---|---|
|
@@ -28,6 +28,6 @@ | |
}, | ||
"dependencies": { | ||
"@alita/types": "3.1.0", | ||
"@umijs/utils": "4.0.32" | ||
"@umijs/utils": "4.0.34" | ||
} | ||
} |
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
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
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
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
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
import type { AlitaApi } from '@alita/types'; | ||
import statePlugin from '@umijs/plugins/dist/initial-state'; | ||
import { logger } from '@umijs/utils'; | ||
|
||
export default (api: AlitaApi) => { | ||
if (!['dev', 'build', 'dev-config'].includes(api.name)) return; | ||
|
||
api.onStart(() => { | ||
logger.info('Using Initial State Plugin'); | ||
}); | ||
statePlugin(api); | ||
}; |
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 @@ | ||
import type { AlitaApi } from '@alita/types'; | ||
import localePlugin from '@umijs/plugins/dist/locale'; | ||
import { logger } from '@umijs/utils'; | ||
|
||
export default (api: AlitaApi) => { | ||
if (!['dev', 'build', 'dev-config'].includes(api.name)) return; | ||
|
||
api.onStart(() => { | ||
logger.info('Using Locale Plugin'); | ||
}); | ||
|
||
localePlugin(api); | ||
}; |
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
Oops, something went wrong.