88 lines
1.5 KiB
Vue
88 lines
1.5 KiB
Vue
<template>
|
|
<ai-fixed-btn v-if="!isTopPage||custom">
|
|
<div class="AiBack" @click.stop="back">
|
|
<img :src="imgHomeUrl + 'back.png'" alt="">
|
|
<text>返回</text>
|
|
</div>
|
|
</ai-fixed-btn>
|
|
</template>
|
|
<script>
|
|
import AiFixedBtn from "./AiFixedBtn";
|
|
|
|
export default {
|
|
name: "AiBack",
|
|
components: {AiFixedBtn},
|
|
props: {
|
|
delta: {
|
|
type: Number,
|
|
default: 1
|
|
},
|
|
eventName: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
data: {
|
|
type: Object | Boolean,
|
|
default: () => {
|
|
}
|
|
},
|
|
custom: Boolean,
|
|
visible: Boolean,
|
|
},
|
|
data() {
|
|
return {
|
|
isTopPage: false
|
|
}
|
|
},
|
|
methods: {
|
|
back() {
|
|
if (this.visible)
|
|
return this.$parent.$emit(this.eventName, this.data)
|
|
|
|
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)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
mounted() {
|
|
this.isTopPage = window.history.length <= 1
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.AiBack {
|
|
width: 108px;
|
|
height: 108px;
|
|
background: #6BA1F9;
|
|
box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.12);
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
|
|
img {
|
|
width: 40px;
|
|
height: 40px;
|
|
}
|
|
|
|
text {
|
|
font-size: 26px;
|
|
font-weight: 800;
|
|
color: #FFFFFF;
|
|
line-height: 40px;
|
|
}
|
|
}
|
|
</style>
|