微信小程序常用 api

1
2
1.显示导航栏加载动画
wx.showNavgetionBarLoading()
1
2
2.隐藏导航栏加载动画
wx.hideNavgetionBarLoading()
1
2
3
4
5
6
7
8
9
10
3.上传本地文件
wx.uploadFile({
url:"",
filePath:"",//文件路径
name:"",//文件接收的参数名
formData:{}//其他上传参数
success(){},
fail(){},
complate(){}
})
1
2
4. 键盘隐藏
wx.hideKeyboard()
1
2
5.隐藏顶部导航栏
"navigationStyle": "custom"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
6.tabber  设置

"tabBar": {
"custom": true,
"color": "#000000",
"selectedColor": "#000000",
"backgroundColor": "#000000",
"list": [{
"pagePath": "pages/index/index",
"text": "监测",
"iconPath": "/imgs/index.png",
"selectedIconPath": "/imgs/index_active.png"
}, {
"pagePath": "pages/record/record",
"text": "记录",
"iconPath": "/imgs/recording.png",
"selectedIconPath": "/imgs/recording_active.png"
}, {
"pagePath": "pages/main/main",
"text": "我的",
"iconPath": "/imgs/main.png",
"selectedIconPath": "/imgs/main_active.png"
}]
}
1
2
3
4
5
6
7
8
9
7.阻止点击事件冒泡行为

将事件的 bind 改成 catch

bind 是阻止不了冒泡的,catch 可以阻止事件的冒泡行为

例如 bindtap 改成 catchtap

<view class="after-sales" catchtap="callPhone">联系售后</view>
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2020-2021 前端老猫
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~

支付宝
微信