事件绑定

  1. 冒泡事件
    1. 定义:当一个组件上的事件触发后,事件会向父节点传递
    2. 事件列表https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/event.htmlopen in new window
  2. 非冒泡事件

绑定事件语法

  1. bind绑定:事件绑定不会阻止冒泡事件向上冒泡

    <view bindtap="handTap" class = 'start_cont>
     <text class='start'>开启</text>
    </view>
    
  2. catch绑定:事件绑定可以阻止冒泡事件向上冒泡

    <view catchtap="handTap" class = 'start_cont>
    <text class='start'>开启</text>
    </view>
    

路由

小程序的路由简单得多,在app.json中配置下路径就可以用了 重新定向api具体看文档 https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.htmlopen in new window

switchTab,reLaunch,redirectTo,navigateTo,navigateBack,

路由跳转默认为相对路径,绝对路径需要在前面加'/'

导航栏配置

全局在app.json里

"window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#ffffff",
    "navigationBarTitleText": "星级服务",
    "navigationBarTextStyle":"black"
  },

局部的配置在页面json里直接加 "navigationBarTitleText": "特殊配置",即可

Last Updated:
Contributors: haizhiguang