返回调整

This commit is contained in:
aixianling
2021-11-23 14:58:51 +08:00
parent a0968bcc83
commit b5ba96c0f3
5 changed files with 21 additions and 17 deletions

View File

@@ -1,5 +1,9 @@
<template>
<ai-fixed-btn v-if="!isTopPage||custom">
<div v-if="btn" class="AiBack" @click.stop="back">
<img :src="$cdn + 'home/back.png'" alt="">
<text>返回</text>
</div>
<ai-fixed-btn v-else-if="!isTopPage||custom">
<div class="AiBack" @click.stop="back">
<img :src="$cdn + 'home/back.png'" alt="">
<text>返回</text>
@@ -12,6 +16,7 @@ import AiFixedBtn from "./AiFixedBtn";
export default {
name: "AiBack",
components: {AiFixedBtn},
inject: {root: {}},
props: {
delta: {
type: Number,
@@ -28,6 +33,7 @@ export default {
},
custom: Boolean,
visible: Boolean,
btn: Boolean
},
data() {
return {
@@ -36,20 +42,14 @@ export default {
},
methods: {
back() {
if (this.visible)
if (this.visible) {
return this.$parent.$emit(this.eventName, this.data)
if (this.custom) {
} else if (this.custom) {
this.$emit("back")
} else uni.navigateBack({
delta: this.delta,
success: () => {
if (this.eventName != '') {
uni.$emit(this.eventName, this.data)
}
},
fail: (err) => {
console.error(err)
} else if (this.custom) {
} else this.root.goto({}, () => {
if (this.eventName != '') {
uni.$emit(this.eventName, this.data)
}
})
}