实现底部导航栏中的扫一扫功能

This commit is contained in:
赵毅 2025-09-17 08:49:18 +08:00
parent 814c59cba4
commit d2f6efbd3f

View File

@ -161,6 +161,25 @@ export default {
jump(e) { jump(e) {
const url = e.currentTarget.dataset.url; const url = e.currentTarget.dataset.url;
const index = e.currentTarget.dataset.idx;
const item = this.navList[index];
// 检查是否为扫码功能
if (item.isScan) {
// 调用uni-app的扫码API
uni.scanCode({
success: (res) => {
// 扫码成功后的处理逻辑
console.log('扫码结果:', res.result);
// 可以根据实际需求对扫码结果进行处理
},
fail: (err) => {
console.log('扫码失败:', err);
}
});
return;
}
// 检查url是否存在且不为空 // 检查url是否存在且不为空
if (!url || url.trim() === '') { if (!url || url.trim() === '') {
this.NotOpen(); this.NotOpen();