微信小程序_结构框架

结构框架

MINA(Miniapp Is Not App)框架中,两个层次:视图层、逻辑层。

页面管理

路由方式触发时机路由前页面路由后页面
初始化小程序打开第一个页面onLoad,onShow
打开新页面API wx.navigateTo,或"<navigator open-type=“navigateTo”">onHideonLoad,onShow
页面重定向API wx.redirectTo,或"<navigator open-type=“redirectTo”"onUnloadonLoad,onShow
页面返回API wx.navigateBack,或"<navigator open-type=“navigateBack”"onUnloadonShow
Tab切换API wx.switchTab,或"<navigator open-type=“switchTab”"
重启动API wx.reLaunch,或"<navigator open-type=“reLaunch”"onUnlandonLoad,onShow

配置文件

app.json

  1. pages
    接收一个数组,指定页面。
"pages":[
    "pages/index/index",
    "pages/logs/logs"
  ]

2.window
设置状态栏、导航条、标题、窗口背景色。

  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "Weixin",
    "navigationBarTextStyle":"black"
  }
  • navigationBarBackgroundColor背景色
  • "backgroundTextStyle"标题色
  • "navigationBarTitleText"标题文字

3.tabBar
是一个数组,配置底部或顶部tab栏

"tabBar": {
    "list": [{
      "pagePath": "pagePath",
      "text": "text",
      "iconPath": "iconPath",
      "selectedIconPath": "selectedIconPath"
    }]
  }

list属性

  • pagePath 页面路径
  • text tab上按钮文字
  • iconPath 图片路径
  • selectedColorPath 选中时图片路径

4.networdTimeout
设置各种网络请求的超时时间

5.debug
开启debug模式,“true”

6.页面配置

视图层

WXML

  • 数据绑定
  • 列表渲染
  • 条件渲染
  • 模板
  • 事件等

WXSS

类同css

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值