-
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.
- Loading branch information
Showing
42 changed files
with
5,107 additions
and
683 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': minor | ||
'@alita/native': minor | ||
'@alita/plugins': minor | ||
--- | ||
|
||
feat: support alita2 |
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,23 @@ | ||
const isSSR = false; | ||
const isCordova = false; | ||
const outputPath = isCordova ? 'www' : 'dist'; | ||
const env = process.env.NODE_ENV; | ||
// 这里需要对应服务器地址 | ||
const path = env === 'development' ? 'http://127.0.0.1:8000/' : outputPath; | ||
|
||
export default { | ||
appType: isCordova ? 'cordova' : 'h5', | ||
mobileLayout: true, | ||
hash: false, | ||
// ssr: isSSR && !isCordova ? {} : false, | ||
outputPath: outputPath, | ||
publicPath: isSSR && !isCordova ? path : './', | ||
keepalive: [/list/], | ||
packageId: 'com.alita.demos', | ||
displayName: 'alita-demos', | ||
// mobile5: true, | ||
aconsole: { | ||
inspx: {}, | ||
console: {}, | ||
}, | ||
}; |
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,98 @@ | ||
import { Request, Response } from 'express'; | ||
|
||
export default { | ||
'POST /api/hello': { | ||
text: 'Alita', | ||
}, | ||
'POST /api/list': (req: Request, res: Response) => { | ||
const dataSource = [ | ||
{ | ||
id: 1, | ||
title: 'Ant Design Title 1', | ||
}, | ||
{ | ||
id: 2, | ||
title: 'Ant Design Title 2', | ||
}, | ||
{ | ||
id: 3, | ||
title: 'Ant Design Title 3', | ||
}, | ||
{ | ||
id: 4, | ||
title: 'Ant Design Title 4', | ||
}, | ||
{ | ||
id: 5, | ||
title: 'Ant Design Title 5', | ||
}, | ||
{ | ||
id: 6, | ||
title: 'Ant Design Title 6', | ||
}, | ||
{ | ||
id: 7, | ||
title: 'Ant Design Title 7', | ||
}, | ||
{ | ||
id: 8, | ||
title: 'Ant Design Title 8', | ||
}, | ||
{ | ||
id: 9, | ||
title: 'Ant Design Title 9', | ||
}, | ||
{ | ||
id: 10, | ||
title: 'Ant Design Title 10', | ||
}, | ||
{ | ||
id: 11, | ||
title: 'Ant Design Title 11', | ||
}, | ||
{ | ||
id: 12, | ||
title: 'Ant Design Title 12', | ||
}, | ||
{ | ||
id: 13, | ||
title: 'Ant Design Title 13', | ||
}, | ||
{ | ||
id: 14, | ||
title: 'Ant Design Title 14', | ||
}, | ||
{ | ||
id: 15, | ||
title: 'Ant Design Title 15', | ||
}, | ||
{ | ||
id: 16, | ||
title: 'Ant Design Title 16', | ||
}, | ||
{ | ||
id: 17, | ||
title: 'Ant Design Title 17', | ||
}, | ||
{ | ||
id: 18, | ||
title: 'Ant Design Title 18', | ||
}, | ||
{ | ||
id: 19, | ||
title: 'Ant Design Title 19', | ||
}, | ||
{ | ||
id: 20, | ||
title: 'Ant Design Title 20', | ||
}, | ||
]; | ||
const { body } = req; | ||
|
||
const { pageSize, offset } = body; | ||
return res.json({ | ||
total: dataSource.length, | ||
data: dataSource.slice(offset, offset + pageSize), | ||
}); | ||
}, | ||
}; |
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,24 @@ | ||
{ | ||
"name": "@examples/alita2", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "alita dev", | ||
"build": "alita build" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@alita/react": "^0.1.0", | ||
"@alitajs/dform": "3.0.0-alpha.1", | ||
"@alitajs/iframe": "^0.0.3", | ||
"@alitajs/list-view": "1.0.7", | ||
"alita": "3.1.1", | ||
"antd": "^4.24.1", | ||
"antd-mobile": "2.3.4", | ||
"antd-mobile-5": "^5.24.2" | ||
} | ||
} |
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,95 @@ | ||
import type { RequestConfig, ResponseError } from 'alita'; | ||
import { | ||
NavBarListItem, | ||
NavBarProps, | ||
TabBarListItem, | ||
TabBarProps, | ||
TitleListItem, | ||
} from 'alita'; | ||
|
||
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 SetGary from './assets/demoIcon/setting.png'; | ||
import SetBlue from './assets/demoIcon/setting1.png'; | ||
|
||
export function getKeepAlive() { | ||
return [/list/]; | ||
} | ||
|
||
export const request: RequestConfig = { | ||
prefix: '', | ||
method: 'post', | ||
errorHandler: (error: ResponseError) => { | ||
// 集中处理错误 | ||
console.log(error); | ||
}, | ||
}; | ||
|
||
const titleList: TitleListItem[] = [ | ||
{ | ||
pagePath: '/', | ||
title: '首页', | ||
}, | ||
{ | ||
pagePath: '/list', | ||
title: '列表', | ||
}, | ||
{ | ||
pagePath: '/settings', | ||
title: '设置', | ||
}, | ||
]; | ||
const navList: NavBarListItem[] = []; | ||
const navBar: NavBarProps = { | ||
navList, | ||
fixed: false, | ||
onLeftClick: () => { | ||
// router.goBack(); | ||
}, | ||
}; | ||
const tabList: TabBarListItem[] = [ | ||
{ | ||
pagePath: '/', | ||
text: '首页', | ||
iconPath: HomeGary, | ||
selectedIconPath: HomeBlue, | ||
title: '首页', | ||
iconSize: '', | ||
badge: '', | ||
}, | ||
{ | ||
pagePath: '/list', | ||
text: '列表', | ||
iconPath: ListGary, | ||
selectedIconPath: ListBlue, | ||
title: '列表', | ||
iconSize: '', | ||
badge: '', | ||
}, | ||
{ | ||
pagePath: '/settings', | ||
text: '设置', | ||
iconPath: SetGary, | ||
selectedIconPath: SetBlue, | ||
title: '设置', | ||
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.
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,3 @@ | ||
html { | ||
--alita-safe-area-bottom: 0 !important; | ||
} |
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,46 @@ | ||
import { query } from '@/services/api'; | ||
import { Effect, Reducer } from 'alita'; | ||
|
||
export interface IndexModelState { | ||
name: string; | ||
} | ||
|
||
export interface IndexModelType { | ||
namespace: 'index'; | ||
state: IndexModelState; | ||
effects: { | ||
query: Effect; | ||
}; | ||
reducers: { | ||
save: Reducer<IndexModelState>; | ||
}; | ||
} | ||
|
||
const IndexModel: IndexModelType = { | ||
namespace: 'index', | ||
|
||
state: { | ||
name: '', | ||
}, | ||
|
||
effects: { | ||
*query({ payload }, { call, put }) { | ||
const data = yield call(query, payload); | ||
console.log(data); | ||
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,46 @@ | ||
import { query } from '@/services/api'; | ||
import { Effect, Reducer } from 'alita'; | ||
|
||
export interface ListModelState { | ||
name: string; | ||
} | ||
|
||
export interface ListModelType { | ||
namespace: 'list'; | ||
state: ListModelState; | ||
effects: { | ||
query: Effect; | ||
}; | ||
reducers: { | ||
save: Reducer<ListModelState>; | ||
}; | ||
} | ||
|
||
const ListModel: ListModelType = { | ||
namespace: 'list', | ||
|
||
state: { | ||
name: '', | ||
}, | ||
|
||
effects: { | ||
*query({ payload }, { call, put }) { | ||
const data = yield call(query, payload); | ||
console.log(data); | ||
yield put({ | ||
type: 'save', | ||
payload: { name: data.text }, | ||
}); | ||
}, | ||
}, | ||
reducers: { | ||
save(state, action) { | ||
return { | ||
...state, | ||
...action.payload, | ||
}; | ||
}, | ||
}, | ||
}; | ||
|
||
export default ListModel; |
Oops, something went wrong.