-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcapacitor.config.ts
More file actions
65 lines (59 loc) · 1.47 KB
/
Copy pathcapacitor.config.ts
File metadata and controls
65 lines (59 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import type { CapacitorConfig } from '@capacitor/cli';
import { KeyboardResize, KeyboardStyle } from '@capacitor/keyboard';
// 检测是否是开发模式
const isDev = process.env.NODE_ENV === 'development';
const config: CapacitorConfig = {
appId: 'com.stark.todos',
appName: 'Todos',
webDir: 'out',
// iOS 配置
ios: {
// 允许在 iPad 和 Mac (Catalyst) 上运行
allowsLinkPreview: true,
scrollEnabled: true,
// 安全区域适配
contentInset: 'automatic',
// 支持 Mac Catalyst
preferredContentMode: 'mobile',
// 视图控制器配置
backgroundColor: '#0f172a',
},
// 服务器配置
server: isDev ? {
// 开发模式:连接到本地 Next.js 开发服务器
url: 'http://localhost:3000',
cleartext: true,
} : {
// 生产模式:使用本地静态文件
androidScheme: 'https',
iosScheme: 'capacitor',
},
// 插件配置
plugins: {
// 启动画面
SplashScreen: {
launchShowDuration: 1500,
launchAutoHide: true,
backgroundColor: '#0f172a',
showSpinner: false,
splashFullScreen: true,
splashImmersive: true,
},
// 状态栏
StatusBar: {
style: 'DARK',
backgroundColor: '#0f172a',
},
// 键盘
Keyboard: {
resize: KeyboardResize.Body,
style: KeyboardStyle.Dark,
resizeOnFullScreen: true,
},
// 触觉反馈
Haptics: {
// 默认启用触觉反馈
},
},
};
export default config;