**/自定义弹出框滚动时页面跟着滚动
给弹窗的盒子设置catchtouchmove=“xxx” ,并且盒子flexd固定定位宽高100% 预览和真机可以看到效果 开发者工具里不生效原理就是catch绑定事件可以阻止事件冒泡
如果弹窗内容要实现滚动那就再弹窗的内容外包层scroll-view 高度或宽度要比内容高度或宽度小就跟正常写的逻辑一样
<view class="showmodal" wx:if="{{showmodal}}" catchtouchmove='true'>
<scroll-view scroll-y="true" height="375rpx">
<view class="box">
<image src="../../../image/close.png" class="close" bindtap="agree"></image>
<view class="title">提示</view>
<view class="conte">
确定转成积分,转化积分后的订单不再参与排单返现
</view>
<view class="btn" bindtap="agree">确定</view>
</view>
</scroll-view>
</view>
**/input的type=’text‘时要求只能输入纯数字
type为text时需要判断汉字 字母 符号 空格 红框是验证字母 符号 空格等 黄框验证汉字 但是实测当快速输入字母或者中文键盘打出字后切换到英文键盘字母依旧存在,所以点击确定的时候再次验证红框
这时按下shirt对应手机的中英文切换输入框出现字母,点击确定后再次判断红框
这是在键盘切换或者按下shirt后应该可以触发什么事件 没找到相关内容 有知道的道友可以回复秀我一脸智商
如果type类型没有要求的话 直接改成number就行 同样开发者里还是可以键盘输入汉字,预览和真机看效果
**/上传图片,本地图片转成网络图片
<view bindtap="upper">上传图片</view>
data:{
pic: [], //存放页面上可以渲染图片的路径集合
},
filepic(){ // 上传图片
//上传图片
var that=this
if(that.data.pic.length>=10){
wx.showToast({
icon:'error',
title: '最多上传10张',
})
return
}
wx.chooseImage({
count: 10, //最多可以选择的图片总数
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success (res) {
console.log('图片上查询',res);
const tempFilePaths = res.tempFilePaths
//启动上传等待中...
for (let i = 0; i < tempFilePaths.length; i++) {
wx.uploadFile({
url: 'https://xinxi.anhchuangyi.cn/api/WechatApi/upload', //后端提供接口
filePath: tempFilePaths[i],
name: 'file',
success:function(res){
var data=JSON.parse(res.data)
console.log(data)
var pic=that.data.pic
var different_src = that.data.different_src
if(data.code == 200){
different_src=different_src+data.img_src+',' //前端需要的地址类型(接口的返回值决定)
pic.push({src:data.src,}) //后端需要的地址类型(接口的返回值决定)
}
that.setData({
pic:pic,
different_src:different_src
})
}
})
}
}
})
},