选择uQRCode插件
使用弹窗的功能将二维码弹出
<uni-popup ref="popup" type="bottom">
<view class="popup-container">
<view class="popup-head">二维码
<image class="close-img" src="../../static/colse-icon.png" mode="heightFix" @click="closeCode">
</image>
</view>
<view class="popup-footer">
<view class="qr-box">
<uqrcode canvas-id="qr" value="text" :options="options" size='248' sizeUnit='rpx'></uqrcode>
</view>
<view class="txt">请扫描</view>
</view>
</view>
</uni-popup>
canvas-id=“qr”,value size sizeUnit 得需要设置
然后在data里面配置
options:{
code: 'https://qm.qq.com/cgi-bin/qm/qr?k=LKqML292dD2WvwQfAJXBUmvgbiB_TZWF&noverify=0',// 生成二维码的值
},
onShow(){
let allPages = getCurrentPages(); //获取当前页面栈的实例;
console.log(allPages);
let lastPages = allPages.length - 1; // 获得倒数第二个元素的索引;
console.log(lastPages);
let option = allPages[lastPages].options; // 获得上个页面传递的参数;
console.log(option);
}
Object.keys(obj)
发送的页面
const list = encodeURIComponent(JSON.stringify(item));
// 转换为参数拼接到url中
uni.navigateTo({
url: '/pages/job/publish?item=' + list
});
接受的页面
onLoad(options) {
// 此页面也可以用于新增 所以如果没有该值就跳转出去
if (!option.item) return;
const item = JSON.parse(decodeURIComponent(option.item));
//后续对数据的处理
}
list1:[
{id:1,name:'武汉',nr:'准一线'},
{id:1,name:'南京',nr:'准一线'},
{id:1,name:'长沙',nr:'准一线'},
{id:1,name:'北京',nr:'一线'},
{id:1,name:'上海',nr:'一线'},
{id:1,name:'咸宁',nr:'十八线'}
]
let map = {};
let myArr = [];
for(let i = 0; i < this.list1.length; i++){
if(!map[this.list1[i].remark]){
myArr.push({
remark: this.list1[i].remark,
data: [this.list1[i]]
});
map[this.list1[i].remark] = this.list1[i]
} else {
for(let j = 0; j < myArr.length; j++){
if(this.list1[i].remark === myArr[j].remark){
myArr[j].data.push(this.list1[i]);
break
}
}
}
}
this.list1 = myArr
payData.success = (res) => {
uni.showToast({
title: '支付成功',
success: () => {
setTimeout(() => {
uni.navigateBack();
}, 2000)
}
})
}
一定要先把数据线清空,不然数据不刷新
onShow() {
this.orderList = []
this.currentPage = 1
this.gettradelist()
}