关于前端:微信小程序基础开发一

8次阅读

共计 1179 个字符,预计需要花费 3 分钟才能阅读完成。

小程序的目录构造


小程序的配置

  • 全局配置(app.js)

1、pages: 示意以后我的项目的子页面,并且门路与左侧的 pages 下的门路齐全对应

"pages":[
    "pages/index/index",//pages 下的第一个门路就是小程序进入显示的页面
    "pages/docu/docu",
    "pages/cander/cander",
    "pages/search/search",
    "pages/logs/logs",
    "pages/demo01/demo01"
  ], 

2、window: 定义小程序所有页面的顶部背景色彩、文字色彩等
详情参考微信小程序官网文档

"window":{
    "backgroundTextStyle":"dark",// 下拉刷新的动画,反对 "dark" 或 "light"
    "navigationBarBackgroundColor": "#fff",// 顶部导航栏背景色彩
    "navigationBarTitleText": "Weixin",// 导航栏题目
    "navigationBarTextStyle":"black",// 题目文字的色彩,只能 "black" 或 "white"
    "enablePullDownRefresh":true // 全局的下拉刷新,默认 "false"
  },

3、tabBar: 指定 tab 栏切换,list 数组内起码两项
详情参考微信小程序官网文档

"tabBar": {
    "list": [
      {
      "pagePath":  "pages/index/index",
      "text": "扫一扫",
      "iconPath": "icon/sao1.png",
      "selectedIconPath": "icon/sao.png"
    },
    {
      "pagePath":  "pages/docu/docu",
      "text": "文件",
      "iconPath": "icon/docu1.png",
      "selectedIconPath": "icon/docu.png"
    },
    {
      "pagePath":  "pages/cander/cander",
      "text": "照相机",
      "iconPath": "icon/cander1.png",
      "selectedIconPath": "icon/cander.png"
    },
    {
      "pagePath":  "pages/search/search",
      "text": "查找",
      "iconPath": "icon/search1.png",
      "selectedIconPath": "icon/search.png"
    }
  ],

  • 页面配置

详情参考微信小程序官网文档
每一个小程序页面也能够应用 .json 文件来对本页面的窗口体现进行配置。页面中配置项在以后页面会笼罩 app.jsonwindow 中雷同的配置项。文件内容为一个 JSON 对象

  • sitemap 配置

sitemap 官网文档
用于配置小程序及其页面是否容许被微信索引

正文完
 0