当前位置:网站首页>Private collection project practice sharing [Yugong series] February 2022 wechat applet -app Other properties of JSON configuration properties

Private collection project practice sharing [Yugong series] February 2022 wechat applet -app Other properties of JSON configuration properties

2022-06-11 13:55:00 Yugong moving code

One 、resizable

stay iPad The applet running on can be set to support screen rotation , stay PC Applet running on , The user can drag the window size in any proportion , You can also maximize the window in the applet menu .
app.json The configuration is as follows ;

      
      
{
resizable:true
}
  • 1.
  • 2.
  • 3.

Two 、usingComponents

stay app.json Custom components declared in are regarded as global custom components , It can be used directly in a page or custom component within an applet without having to declare .
app.json The configuration is as follows ;

      
      
{
usingComponents: ' Global component path '
}
  • 1.
  • 2.
  • 3.

3、 ... and 、permission

Applet interface permission related settings . Field type is Object.
app.json The configuration is as follows ;

      
      
{
"pages": [ "pages/index/index"],
"permission": {
"scope.userLocation": {
"desc": " Your location information will be used to show the effect of the applet location interface " // Continuous background positioning of Expressway driving
}
}
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.

Four 、sitemapLocation

In the applet root directory sitemap.json This file is used to configure whether the applet and its page can be indexed by wechat , The content of the document is a JSON object , without sitemap.json , All pages are allowed to be indexed by default .
sitemapLocation The function of is to specify sitemap.json The path of
app.json The configuration is as follows ;

      
      
{
"pages": [ "pages/index/index"],
"sitemapLocation": "sitemap.json"
}
  • 1.
  • 2.
  • 3.
  • 4.

5、 ... and 、style

"style": "v2" Indicates that a new version of the component style is enabled .
app.json The configuration is as follows ;

      
      
{
"style": "v2"
}
  • 1.
  • 2.
  • 3.

6、 ... and 、useExtendedLib

Specify the extension library to reference . At present, the following projects are supported :

  • kbone: Multi terminal development framework
  • weui: WeUI Component library

After designation , It is equivalent to introducing the latest version of the corresponding extension library npm package , At the same time, it does not occupy the package volume of the applet .
app.json The configuration is as follows ;

      
      
{
"useExtendedLib": {
"kbone": true,
"weui": true
}
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.

7、 ... and 、entranceDeclare

Chat location messages are opened with a taxi applet , Details refer to .
app.json The configuration is as follows ;

      
      
"entranceDeclare": {
"locationMessage": {
"path": "pages/index/index",
"query": "foo=bar"
}
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.

Page get message

      
      
//app.js
App({
onLaunch: function ( options){
console. log( options)
var scene = options. scene
if ( scene == 1146) { // Location message scene value
var location = options. locationInfo
var x = location. latitude
var y = location. longitude
var name = location. name
}
},
})
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.

8、 ... and 、darkmode and themeLocation

1.darkmode

stay app.json Middle configuration darkmode by true, This means that the current applet has been adapted to DarkMode, All basic components will display different default styles according to the system theme ,navigation bar and tab bar It will also switch automatically according to the following configuration .

2.themeLocation

Customize theme.json The path of , When configuring "darkmode":true when , Current profile is required .

      
      
{
"darkmode": true,
"themeLocation": "/path/to/theme.json"
}
  • 1.
  • 2.
  • 3.
  • 4.

Nine 、lazyCodeLoading

At present, only the value requiredComponents, On behalf of opening the applet 「 Inject... As needed 」 characteristic .

      
      
{
"lazyCodeLoading": "requiredComponents"
}
  • 1.
  • 2.
  • 3.

Ten 、singlePage

Now share with the circle of friends (Beta) After opening, it will enter single page mode
Single page mode related configuration

attribute

type

Required

The default value is

describe

navigationBarFit

String

no

Auto adjust by default , If the original page is a custom navigation bar , Then for float, Otherwise squeezed

The intersection state between the navigation bar and the page , The value is float Indicates that the navigation bar is floating on the page , Intersect with page ; The value is squeezed Indicates that the page is squeezed by the navigation bar , Does not intersect the page

11、 ... and 、embeddedAppIdList

Specify that the applet can pass through wx.openEmbeddedMiniProgram List of open applets .

      
      
{
"embeddedAppIdList": [ "wxe5f52902cf4de896"]
}
  • 1.
  • 2.
  • 3.

Twelve 、halfPage

The full screen state of the first page uses a custom top , Support default / custom

      
      
{
"halfPage": {
"firstPageNavigationStyle": "custom"
}
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.


原网站

版权声明
本文为[Yugong moving code]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203012045008144.html