首先在popup上创建change事件
用上面创建的change事件控制focus状态值
将popup显示状态赋值给focus状态
将这两个方法覆盖原先uni-popup中的方法,代码如下粘贴
open() {
this.showPopup = true
this.$nextTick(() => {
new Promise(resolve => {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.showTrans = true
resolve();
}, 50);
}).then(res => {
this.$emit('change', {
show: true
})
})
})
},
close(type) {
this.showTrans = false
this.$nextTick(() => {
this.$emit('change', {
show: false
})
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.showPopup = false
}, 300)
})
},