定义方法:
const customizeBack = ()=>{
const canNavBack = getCurrentPages()
if (canNavBack && canNavBack.length > 1) {
uni.navigateBack({
delta: 1
})
} else {
history.back()
}
}
Vue.prototype.$customizeBack = customizeBack; //定义全局方法
全局方法调用:this.$customizeBack();