let app = getApp();
wxs的用法(小程序)
=>官网wxml文件<wxs src="./data.wxs" module="shishi"/><view>{{shishi()}}</view>data.wxs文件function shsihi(){ return 111}module.exports=shsihi例子:wxs<view>{{shishi(time)}}</view>function shsihi(time){ var date= getDate(time) return date.getFullYear()+-+(date.getM
小程序的组件>微信小程序组件通信=>父传子,子传父,组件生命周期,slot
微信小程序组件Component({properties:{myProperty:{//属性名type:String,value:},myProperty2:String//简化的定义方式},data:{},//私有数据,可用于模板渲染lifetimes:{created(){//在组件实例刚刚被创建时执行},attached(){//在组件实例进入页面节点树时执行},ready(){
自定义导航栏(小程序)
1.app.js:计算:导航栏高=状态栏高+标题栏高;标题栏高=胶囊高+胶囊距离状态栏的高*2;App({globalData:{//屏幕高度默认状态下screenHeight=windowHeight+statusBarHeightscreenHeight:667,//可使用窗口高度使用自定义状态栏时候windowHeight==screenHeightwindowHeight:667,//状态栏的高度statusBarHeight:20,//胶囊高度customBarHeight:32,//导航栏高度navHeight:60,//
input获取输入框内容以及事件传值篇(微信小程序)
html<view> <view> <input type="text" value="{{myText}}" bindinput="bindViewTap"/> <button bindtap="getUserProfile">add</button> </view> <view wx:for="{{list}}" wx:key="index"> //----------传值--------------------------------------------------------
vtabs
https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/extended/component-plus/vtabs.html
scroll-view(小程序)
垂直方向wxml<scroll-view class="scroll" scroll-y="{{true}}" refresher-enabled={{true}} ------------------------------------>是否开启下拉刷新 bindrefresherrefresh=handleRefresherpulling---------------------->刷新触发事件 bindscrolltolower="handlescrolltolower"---------------------------->触
微信小程序request封装
//request.jsfunctionrequest(options){returnnewPromise((resolve,reject)=>{wx.request({url:options.url,method:options.method||GET,data:options.data||{},header:options.header||{},success:resolve,fail:reject})})}functi