app.json 是一个用于描述小程序的配置文件,其中包含了小程序的全局配置和页面配置。以下是一些常见的设置:

  1. 设置小程序的名称和版本号:
{
  'name': '我的小程序',
  'version': '1.0.0'
}
  1. 设置小程序的默认页面:
{
  'pages': [
    'pages/index/index',
    'pages/about/about'
  ],
  'window': {
    'navigationBarTitleText': '我的小程序'
  }
}
  1. 设置小程序的底部导航栏:
{
  'tabBar': {
    'color': '#999',
    'selectedColor': '#333',
    'backgroundColor': '#fff',
    'list': [
      {
        'pagePath': 'pages/index/index',
        'text': '首页',
        'iconPath': 'images/home.png',
        'selectedIconPath': 'images/home-active.png'
      },
      {
        'pagePath': 'pages/user/user',
        'text': '我的',
        'iconPath': 'images/user.png',
        'selectedIconPath': 'images/user-active.png'
      }
    ]
  }
}
  1. 设置小程序的网络请求域名:
{
  'networkTimeout': {
    'request': 10000,
    'downloadFile': 10000
  },
  'debug': true,
  'request': {
    'domain': 'https://api.example.com'
  }
}
  1. 设置小程序的分享信息:
{
  'window': {
    'navigationBarTitleText': '我的小程序',
    'navigationBarBackgroundColor': '#fff',
    'navigationBarTextStyle': 'black',
    'backgroundColor': '#f5f5f5'
  },
  'shareAppMessage': {
    'title': '分享标题',
    'desc': '分享描述',
    'path': '/pages/index/index',
    'imageUrl': 'https://example.com/images/share.png'
  }
}
小程序 app.json 配置详解:设置名称、页面、导航栏、域名、分享等

原文地址: https://www.cveoy.top/t/topic/odAW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录