微信小程序--获取通过data-* 穿的值

.rowsal {display: flex;justify-content: space-around;flex-direction: column;}  /* 盒子内容竖向中间间隙布局 */
.rowsbl {display: flex;justify-content: space-between;flex-direction: column;}  /* 盒子内容竖向两端间隙布局 */



.rowsa {display: flex;justify-content: space-around;}  /* 盒子内容居中间间隙布局 */
.rowsb {display: flex;justify-content: space-between;}  /* 盒子内容两端间隙布局 */
  1. git push -f origin master强制推送

  2. "compatible": {

  3. "ignoreVersion": true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持

  4. },

pointer-events: none;、、透过节点点击

执行npm install的时候前清理缓存

npm cache clear --force

wx.getSystemInfoSync()

  onShareAppMessage () {
		    return {
		      title: this.zxInfo.title,    //自定义标题   string
		      path: 'pages2/zxInfo/zxInfo?id='+ this.zxInfo.id, //这个地址需要把页面路径拼接的参数发送出去,直写页面地址的话,别人进入会是空的页面
			    imageUrl:this.zxInfo.newsImage   //图片地址
			}  
		  },
		  onShareTimeline () {
		    let img = this.data.path_image+this.data.shop.shop_img  //取得是每个店铺的图和店铺名称
		    console.log(img)
		    return {
		      title: this.zxInfo.title,    //自定义标题   string
		        path: 'pages2/zxInfo/zxInfo?id='+ this.zxInfo.id, //这个地址需要把页面路径拼接的参数发送出去,直写页面地址的话,别人进入会是空的页面
		      
		      imageUrl:this.zxInfo.newsImage   //图片地址
		    }
		  },

文字背景宽度自适应
  

  width: fit-content;

数据库sql执行时间

show processlist

渐变

background:linear-gradient(to right,#fff,#000)

四周阴影

box-shadow: darkgrey 0px 0px 30px 5px;

VUE创建项目

vue init webpack projectName

nuiapp支付

toPaying(payinfo){
				var provider="";
				if(this.payType==2){
					provider='wxpay'
				}else if(this.payType==1){
					provider='alipay'
				}
				console.log(this.payType,provider,payinfo)
				uni.requestPayment({   
				    provider:provider,
				    orderInfo: payinfo, //微信、支付宝订单数据
				    success:  (res)=> {
				        this.$tools.showToast("支付成功");
						uni.navigateBack({
							delta:1
						})
				    },    
				    fail:  (err)=> {  
				         this.$tools.showToast("支付失败");
				    }   
				});
			}

递归上传图片

// 参数1  下标  参数2上传之后路径   参数3  本地图片   
			uploadimg(index,listu,listb){
				this.$axios
					.axiosUpload(this.$paths.uploadcommon, listb[index])
					.then(res => {
						if(res.code==1){
							console.log("上海城结果",res)
							listu.push(res.data.url);
							if(listu.length!=listb.length){
								this.uploadimg(index+1,listu,listb);
							}else{
								console.log("上传完成");
								console.log(index,listu,listb)
								this.zhutuImg=this.zhutuImg.concat(listu);
								this.form.images=this.zhutuImg.join(",")
							}
						}else{
							this.$tools.showToast(res.msg);
						}
					})
					.catch(err => {
						console.log('错误回调', err);
					});
			},














chooimg(type){
				uni.chooseImage({
				    count: 9, //默认9
				    sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
				    sourceType: ['album'], //从相册选择
				    success:  (res)=> {
						var imglist=res.tempFilePaths;
						if(type==0){
							this.uploadimg(0,[],imglist);
						}else if(type==1){
							this.uploadOneImg(1,imglist[0]);
						}
				    }
				});
			},




验证码

sendcode(){
					var data=this.form;
					if(data.phone==""){
						this.$tools.showToast("请输入电话");
						return false;
					}
					this.$axios
						.axios('POST', 
						this.$paths.getVerificationCode, 
						data)
						.then(res => {
							if(res.code==0){
								this.$tools.showToast("短信发送成功");
								 clearInterval(this.dingshiqi);  
								this.dingshiqi=setInterval(res=>{
									if(this.daojishi-1<=0){
										this.daojishi=100;
										 clearInterval(this.dingshiqi);  
									}else{
										this.daojishi=this.daojishi-1
									}
								},1000)
							}else{
								this.$tools.showToast(res.msg);
							}
						})  
						.catch(err => {
							console.log('错误回调', err);
						});
				},


'dingshiqi':"",
				daojishi:100





<view class="shenqingyanzhnegm"
				@click.stop="sendcode"
				>
				<block v-if="daojishi==100">
					获取验证码
				</block>
				<block v-else>
					重新发送{{daojishi}}
				</block>
				</view>




防止图片被挤压

flex-shrink: 0;/*防止被压缩*/

onNavigationBarButtonTap(e) {
            let attList = this.list;//全部的数据
            let detail = {};//存放的数据
            attList.forEach(oneone => {
                if(oneone.show) {
                    detail = oneone;//存放的数据
                }
            })
            console.log('存放的数据',detail)
            if(detail && detail.lon && detail.lat) {
                app.placeReceiveDetail.start_area = detail.name + ',' + detail.address;//起点
                app.placeReceiveDetail.start_lon = detail.lon;//起点经度
                app.placeReceiveDetail.start_lat = detail.lat;//起点维度
                uni.switchTab({
                    url:'/pages/tabbar/home'
                })
            } else {
                this.showtt('请选择起点')
            }
        },

"titleNView": {
"buttons": [{
"text": "编辑",
"fontSize": "30rpx",
"width": "auto",
"color": "#000000",
"float": "right"
}]
}

//去掉最后一位

str=str.slice(0,str.length-1)

给上个页面传值

    uni.$emit("getAddress",{address:item});

uni.$on("getAddress", res => {
                this.addressInfo=res.address;
            })

//支付成功

res1.errMsg.indexOf("ok")

//刷新页面

this.$forceUpdate();  

解决云函数报错

npm install --save wx-server-sdk

npm install --save wx-server-sdk@latest

parseInt(res.currentTarget.dataset.index);

  JSON.stringify(jsonstr);  //可以将json对象转换成json对符串

  JSON.parse(jsonstr); //可以将json字符串转换成json对象

var str='1250' ; 
Number(str) ; //得到1250 
parseInt(str); //得到1250 

var str1='00100'; 

 Number(str1) ; //得到100 
parseInt(str1); //得到64 

arr.splice(1,2)   //删除元素

Math.round(num*100)/100  保留两位小数

toFixed自带补位功能

var num4 = 55.3; 

console.log(num4.toFixed(2));

var num5 = 55; 

parseFloat("22.34.5");  //returns  22.34 

  <block wx:if="{{}}">
  </block>
  <block wx:else>
  </block>
	toUseCoupon:function(res){
		var index=res.currentTarget.dataset.index
	}

分隔数组

var str = "aaa,bbb,ccc";
var arr = str.split(',');

查看类型

typeof()

是不是用flex布局的?如果是的话,a这个css加上flex-shrink:0 如果不是的话,那就用给a一个宽度吧

保留两位小数

parseFloat(a.toFixed(2))

//-----------------

红色的是数字,绿色的是字符串

//自定义顶部导航栏

"navigationStyle":"custom"

///json文件配置

"navigationBarBackgroundColor": "#E60121",

"navigationBarTextStyle": "white",

"navigationBarTitleText": "推荐列表"

循环

<block wx:for="{{[1,1,1,1,1,1,1,1,1,1,1]}}">

            </block>

获取当前时间

	getNewDate:function(){
		var myDate = new Date();//获取系统当前时间
		var year= myDate.getFullYear(); //获取完整的年份(4位,1970-????)
		var month=myDate.getMonth()+1; //获取当前月份(0-11,0代表1月)
		var day=myDate.getDate(); //获取当前日(1-31)
		return year +"-"+ month+"-"+day;
	}

图片上传转base64

     1. uploaderListbase64: [],//转为base64的图片地址

     2.    let uploaderListbase64 = that.data.uploaderListbase64;

     3.    uploaderListbase64.push(wx.getFileSystemManager().readFileSync(res.tempFilePaths[0], "base64"));

     4.         uploaderListbase64: uploaderListbase64

<view  class="roww center_left1" style="border-top:1px solid #CEC9C9;margin: 40rpx 20rpx 20rpx 20rpx;">
    <view style="font-size:30rpx;margin-top:-20rpx;background:#f5f5f5;padding:0rpx 20rpx;" class="center_left1" >慧族科技提供技术支持</view>
</view>

wx.cloud.callFunction({

name: 'login',

data: {

}

}).then(

res => {

console.log(res);

app.openid = res.result.openid

// app.openid = 'opAWv4kWuCJLkJnwdHwc2VDPxXmk';

this.getDaiqianzi();

}

)

//不被挤压

inline-block

//滚动

catchtouchmove="preventTouchMove"

 preventTouchMove() 
  { },

//按钮隐藏

<button open-type='contact'

style="position:absolute;width:750rpx;height:50rpx;left:0rpx;opacity:0;"

class="fenxianganniu11 tag2 font_size5_r"></button>

停止顶部刷新

wx.stopPullDownRefresh();

自定义顶部导航栏

  "navigationStyle": "custom"

分享朋友圈

 onShareTimeline: function () { 
      return {
        title: "大旺嘉和",
        imageUrl: this.data.bannerlist[0].img,
        path: '/pages/home/home'
      }
  },

onShareAppMessage:function(res) {
    if (res.from == 'button') {
        console.log(res.target, res)
    }
    return {
      title:'这里是发送时候的标题',
      path:'/pages/home/index',//这里是被分享的人点击进来之后的页面
      imageUrl: '../../images/icon-logo.png'//这里是图片的路径
    }
  },

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飞飞翼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值