capacitor.config.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { CapacitorConfig } from '@capacitor/cli';
  2. const config: CapacitorConfig = {
  3. appId: 'com.example.app',
  4. appName: 'wallet_app',
  5. webDir: 'dist',
  6. // 开发服务器配置(热更新用)
  7. server: {
  8. url: 'http://192.168.0.59:5173',
  9. cleartext: true, // 允许HTTP明文通信(仅开发环境)
  10. allowNavigation: ['*'] // 允许任意URL导航
  11. },
  12. // 插件配置
  13. plugins: {
  14. SplashScreen: {
  15. launchShowDuration: 3000,
  16. launchAutoHide: true,
  17. backgroundColor: '#ffffffff', // ARGB格式白色背景
  18. androidScaleType: 'CENTER_CROP',
  19. showSpinner: false,
  20. androidSpinnerStyle: 'large',
  21. iosSpinnerStyle: 'small',
  22. spinnerColor: '#999999',
  23. splashFullScreen: true,
  24. splashImmersive: true,
  25. androidSplashResourceName: 'splash',
  26. useDialog: false
  27. },
  28. CapacitorAssets: {
  29. iconBackgroundColor: '#ffffff' // 应用图标背景色
  30. },
  31. // 注意:原JSON中嵌套了重复的"plugins"键,已修正
  32. PushNotifications: {
  33. presentationOptions: ['badge', 'sound', 'alert']
  34. }
  35. },
  36. // 资源文件配置
  37. // assets: {
  38. // splash: {
  39. // src: 'assets/splash.png', // 启动图路径
  40. // android: true,
  41. // ios: true
  42. // }
  43. // },
  44. // iOS专属配置
  45. ios: {
  46. scheme: 'App',
  47. scrollEnabled: true,
  48. },
  49. // Android专属配置
  50. android: {
  51. allowMixedContent: true, // 允许混合HTTP/HTTPS内容
  52. useLegacyBridge: true, // 使用旧版桥接(兼容性)
  53. // 签名证书配置(建议通过环境变量注入敏感信息)
  54. buildOptions: {
  55. keystorePath: 'f62.keystore',
  56. keystoreAlias: 'f62', // // 生成时指定的别名
  57. keystorePassword: 'LkSvN1Ys', // 从环境变量读取
  58. keystoreAliasPassword: 'LkSvN1Ys'
  59. }
  60. }
  61. };
  62. export default config;