Summary of WeChat Mini Program page and size units

Quickly generate pages

  • Add "pages / news / news" in app.json
{
  "pages": [
    "pages/welcome/welcome",
    "pages/index/index",
    "pages/logs/logs",
    //添加列
    "pages/news/news"
   
  ],
  "window": {
    "backgroundTextStyle": "light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "测试页面",
    "navigationBarTextStyle": "black"
  },
  "style": "v2",
  "sitemapLocation": "sitemap.json"
}

important point:

  • Equivalent to
  • 750rpx any phone size can fill the full screen

concerned department

  • pt logical resolution (visual unit, related to screen size)
  • px physical resolution (pixels)
  • ppi pixels per inch

Conversion relationship of small program units

  • 1px = 1rpx = 0.5pt under iphone6 ​​(rpx will convert on different devices, but px will not)


Path problem

  • relative path
    • <image src="../../img/timg (1).jpg"></image>
  • Absolute path
    • use'/'
    • <image src="/img/timg (1).jpg"></image>
49 original articles published · Like 3 · Visits 5096

Guess you like

Origin blog.csdn.net/weixin_43487066/article/details/105467626