1.naviagtor

1.open-type:

navigate有返回redirect无返回switchTab跳转有tabBar的页面2.tabBar

2.在app.json中设置,

pagePath必须在pages中设置/pages/...iconPath不支持网络图片selectedIconPath不支持网络图片text文字3.background-image

3.小程序background-image不支持本地资源,要base64格式/网上链接

4.text

4.text中引用空格:

首先需要设置text控件的decode值decode可以解析的有 <>&'  

5.eg:

textdecode="emsp"style="color:#fff;"相爱一生   陪伴到老/textensp中文字符空格一半大小emsp中文字符大小nbsp根据字体设置的空格大小5.箭头函数

6.箭头函数不能使用this

6.获取屏幕宽度、高度this.setData({imageWidth:wx.getSystemInfoSync().windowWidth})7.设置全局变量app.jsglobalData:{userInfo:null,imgUrl:'http://xu.jeft-hai.top/images/'}使用*.jsvarapp=getApp();varimgUrl=app.globalData.imgUrl;data({imgUrl:imgUrl})8.背景音乐//playconstbackgroundAudioManager=wx.getBackgroundAudioManager();backgroundAudioManager.src=this.data.musicList[idx];backgroundAudioManager.title='';backgroundAudioManager.startTime=8;BackgroundAudioManager.play();

7.ios下必须有title才可以播放

//pauseconstbackgroundAudioManager=wx.getBackgroundAudioManager();backgroundAudioManager.pause();9.数据渲染wx:for="{{}}"wx:for-item='"item"wx:key='key'wx:for-index="index"10.预览图片previewImage(e){vardataset=e.target.dataset;varpath=dataset.path;vartarget=dataset.target;varsrc=this.data.imgUrl+this.data.person+'/'+path+'/'+target;varlist=dataset.list;varurls=[];list.forEach((item,index)={item=this.data.imgUrl+this.data.person+'/'+path+'/'+item;urls.push(item);})wx.previewImage({urls:urls,//arrcurrent:src//当前})}11.分享onShareAppMessage:function(){return{title:'',//默认小程序的名字必须有desc:'',//默认小程序的名字不必有imageUrl:'',//有:img,没有:页面截屏path:'/template/temp/temp?id='+this.data.idx}}

TAG标签: 微信小程序微信小程序meta标签小程序标签

http://www.xiaochengxub.com/read-98465.html