记录下遇到的小问题及解决办法
小程序图片地扯转base64
wx.request({
url: "图片地址",
method: 'GET',
responseType: 'arraybuffer',
success: (res) => {
if (res && res.header && res.header['Set-Cookie']) {
wx.setStorageSync('myCookie', res.header['Set-Cookie']);
}
let base64 = wx.arrayBufferToBase64(res.data);
let imageBase64 = 'data:image/jpg;base64,' + base64;
this.setData({
imgUrl: imageBase64
})
}
})
微信小程序自定义Modal弹出框
小程序请求超时处理
小程序组件传值及调用方法
小程序input输入框获取焦点时,placeholder文字会出现闪动
好像是官方的一个很久的bug,一直没解决
微信小程序获取当前设备可视屏幕的宽和高(rpx)
wx.getSystemInfo({
success: res => {
let clientHeight = res.windowHeight;
let clientWidth = res.windowWidth;
let changeHeight = 750 / clientWidth;
this.globalData.scrollViewHeight = clientHeight * changeHeight;
}
})
微信小程序使用阿里矢量图标
下载至本地
使用
<text class="iconfont icon-eye-open"></text>
input 事件触发时会出现一丝丝卡顿现象
foucs的时候显示输入框右侧删除icon,要稍微滞后一点,最后改为用tap事件解决
input密码可见与不可见问题
切换密码可见与否 password="{{!passwordShow}}"
<input password="{{!passwordShow}}" placeholder="密码" placeholder-style="color:#ccc" adjust-position="true" value="{{password}}" focus="{{passwordFocus}}" bindtap="passwordTap" bindblur="passwordBlur" bindinput="passwordChange" />
wx:for 多层嵌套循环
<view wx:for="{{parent}}" wx:key="id">
<view>{{index+1}}、{{item.name}}</view>
<view wx:for="{{item.childData}}" wx:for-item="child" wx:key="id">
{{child.name}}---{{item.name}}
</view>
</view>









网友评论