源文件

This commit is contained in:
gyq
2024-05-23 14:39:33 +08:00
commit a1128dd791
2997 changed files with 500069 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import onceVar from '@/util/onceVar.js'
import { onBackPress } from '@dcloudio/uni-app'
import {nextTick} from 'vue'
/*
本函数用于阻断返回操作当页面开启图片预览与选择框时app上的返回操作会直接返回到上一级页面不符合正常的体验。 所以触发返回事件,优先关闭图片预览与其他弹窗
参数fun 为具体使用页面的关闭弹窗函数,需要在这里执行一次
onceVar 为全局唯一变量,保存在内存中。 可用vuex代替
*/
export default function (fun) {
onBackPress((option) => {
if (onceVar.imgView()) {
nextTick(() => {
fun()
inactive()
})
return true
}
return false
})
const active = () => onceVar.imgView(true)
const inactive = () => onceVar.imgView(false)
return { active, inactive }
}