博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
记录微信小程序一些小细节
阅读量:6955 次
发布时间:2019-06-27

本文共 1378 字,大约阅读时间需要 4 分钟。

一.基本小设置

1,设置微信程序导航标题

onLoad() {    wx.setNavigationBarTitle({      title: `首页`    })  },复制代码

2,微信小程序组件传值

3,微信小程序自定义导航栏

在appjs的window内加入--- "navigationStyle": "custom"复制代码

注意:

wx.getSystemInfo 和 wx.getSystemInfoSync 获取机器信息screenHeight - windowHeight 计算标题栏高度标题栏高度:‘iPhone’: 64,‘iPhone X’: 88,‘android’: 68复制代码

4,微信小程序缓存区别

5,微信小程序import引入模块(wxss/js/wxml)

1,写好模块布局样式,引入模块布局样式,即可使用;wxml引入文件:@import "/components/swiper/swiper-default.wxmlwxss引入文件:@import "/components/swiper/swiper-default.wxss";复制代码

6,封装request;

const $get = (url, data) => {  return new Promise((resolve, reject) => {    wx.request({      url,      data,      header: { 'Content-Type': 'json' },      success: resolve,      fail: reject    })  })}// 使用util.$get(`${movieUrl}/api/v2/article`, { app_id: 6, cid: 4, article_id: this.data.article_id }).then(res => {  if (res.data.status === 0) {    this.processData(type, res.data.data.articles)  }}).catch(e => {  this.setData({    isLoading: true,    hasMore: false  })  wx.stopPullDownRefresh()  wx.showToast({ title: `网络错误!`, duration: 1000, icon: "none" })})复制代码

7,小程序下拉刷新;

onPullDownRefresh:function()  {    wx.showNavigationBarLoading() //在标题栏中显示加载    //模拟加载    setTimeout(function()    {      // complete      wx.hideNavigationBarLoading() //完成停止加载      wx.stopPullDownRefresh() //停止下拉刷新    },1500);  },复制代码

转载于:https://juejin.im/post/5caf04adf265da038860a45a

你可能感兴趣的文章
Go语言编程----文章汇总
查看>>
nginx做反向代理proxy_pass,proxy_redirect的使用
查看>>
Mybatis的整体架构
查看>>
给出两个单词,找到它们的最短距离 (以它们之间隔了多少个单词计数)。
查看>>
NexentaStor 安装篇
查看>>
Graphical installers are not supported by the VM解决办法
查看>>
我的大学之路---2012在迷雾中前进
查看>>
FF下margin不起作用的问题
查看>>
idea 自动导包
查看>>
mysql主从常见问题
查看>>
iOS 截屏
查看>>
Javascript 经典资料分享大家一起顶
查看>>
linux 系统 stty 的使用
查看>>
搭建Web服务器之Step2:VMware下虚拟机NAT联网设置
查看>>
Android 多线AsyncTask详解
查看>>
我的友情链接
查看>>
使用AdminLTE
查看>>
Armstrong数
查看>>
C# StringHelper
查看>>
c++ 植物类 继承多态 菱形继承
查看>>