主要场景适配于 微信小程序,微信浏览器,企业微信,浏览器等 用于给h5添加底部返回,区分 安卓 ios场景兼容适配。
无 history 时 置灰 不可点击
.vue
<template>
<div v-show="showNavigate" class="dt-navigation-box" :class="customParams ? 'dt-navigation-box1' : ''">
<div class="dt-navigation-btn" @click.stop="clickPrev">
<span class="dt-navigation-arrow">
<i class="iconfont"></i>
</span>
</div>
<div class="dt-navigation-btn">
<span class="dt-navigation-arrow" style="transform: rotate(180deg)">
<i class="iconfont" style="color: rgba(25, 31, 37, 0.25); font-size: 14px"></i>
</span>
</div>
</div>
</template>
<script>
import judgedPlatForms from './utils';
export default {
name: 'DtNavigation',
props: {
customParams: {
type: Boolean,
default: true,
},
},
data () {
return {
showNavigate: false,
};
},
watch: {
$route: {
handler () {
this.filterPlatform();
},
},
},
created () {
this.filterPlatform();
},
methods: {
doMethod () {
this.$nextTick(() => {
const backClass = document.querySelector('.navigation-fixed-btn');
if (backClass) {
backClass.style.bottom = '44px'
}
this.updateFlexbtn();
});
},
async filterPlatform () {
const status = await judgedPlatForms();
this.showNavigate = status;
if (status) {
const app = document.querySelector('#app');
this.$nextTick(() => {
if (app) {
app.style.paddingBottom = 'calc(44px + constant(safe-area-inset-bottom))';
app.style.paddingBottom = 'calc(44px + env(safe-area-inset-bottom))';
app.style.height = 'calc(100% - 44px)';