
小程序也让人头疼
小程序学习以及bug解决
程序员张礼奎
全栈,经验,教程,资源。
展开
-
小程序发送请求封装(request)
1、封装export default function request(options){ return new Promise((resolve, reject) => { wx.request({ url: options.url || '', method: options.method || 'get', data: options....原创 2019-07-13 17:32:52 · 1046 阅读 · 0 评论 -
小程序登录操作实现
1、登录方法 //首次登陆验证 login(){ console.log("发送了请求") // 登录 wx.login({ success: res => { // 发送 res.code const code = res.code; //到后台换取 openId wx.request...原创 2019-07-13 19:08:55 · 3015 阅读 · 0 评论 -
小程序 navigator向其他页面传值(由内向外)
//页面退出时调用 onUnload(){ //获取当前所有的页面 const pages = getCurrentPages(); console.log(pages); //这就是首页的页面对象 const home = pages[pages.length - 3]; home.setData({ title:'navigat...原创 2019-07-13 19:44:44 · 1370 阅读 · 0 评论 -
小程序topBar封装,小程序自定义头部导航栏
1、页面<view class="tabctrl"> <block wx:for="{{titles}}" wx:key="index"> <view class="tab-item {{currentindex == index ? 'active' : ''}}" bind:tap="onItemClick"...原创 2019-07-25 22:19:51 · 522 阅读 · 0 评论 -
小程序tab选项卡请求我的订单数据筛选处理(待收货、代发货、已完成等)
1、页面<view class="navbar"> <lable wx:for="{{navbar}}" data-idx="{{index}}" class="item {{currentTab==index ? 'active' : ''}}" wx:key="unique" bindtap="navbarTap"> //item在js文件里面定义数组 ...原创 2019-08-19 22:51:05 · 3494 阅读 · 0 评论 -
小程序把时间戳转为时间格式,前端通用
/** * 时间戳转化为年 月 日 时 分 秒 * number: 传入时间戳 * format:返回格式,支持自定义,但参数必须与formateArr里保持一致*/function nformatTime(number, format) { var formateArr = ['Y', 'M', 'D', 'h', 'm', 's']; var returnArr = [];...原创 2019-09-02 14:05:19 · 2601 阅读 · 0 评论 -
小程序发送请求封装(request)第二种方式
1、utils.js文件里面重写request方法/** * 封封微信的的request */function request(url, data = {}, method = "GET", contentType ="application/json") { return new Promise(function (resolve, reject) { wx.request(...原创 2019-09-02 14:12:52 · 1296 阅读 · 0 评论 -
小程序如何长按图片保存图片到手机本地相册?
wxml<button class='btn' bindtap='postSave'>保存到本地相册</button>js// 保存二维码 postSave(e) { let _this = this; wx.showLoading({ title: '保存中...' }) wx.downloadFile({ ...原创 2019-09-09 16:39:29 · 2152 阅读 · 0 评论 -
收藏几个小程序动画效果
//渐入,渐出实现 show: function (that, param, opacity) { var animation = wx.createAnimation({ //持续时间800ms duration: 800, timingFunction: 'ease', }); //var animation = this.an...原创 2019-09-19 14:56:12 · 755 阅读 · 0 评论