ReedawFoodApp/pages/target/target.vue

97 lines
1.8 KiB
Vue

<template>
<view class="content ">
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {}
},
onTabItemTap(item) {
// #ifdef MP-WEIXIN
// 监听 Tab 点击,立即跳转外部小程序
uni.navigateToMiniProgram({
appId: "wxdd371c9267b7299b",
path: "/pages/index/index",
success(res) {
console.log('跳转成功');
if (res.cancel) {
uni.showToast({
title: "您已取消操作",
icon: 'none',
duration: 3000
})
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
}, 500)
}
},
fail() {
uni.showToast({
title: "您已取消操作",
icon: 'none',
duration: 3000
})
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
}, 500)
}
});
// #endif
// #ifdef APP-PLUS||APP
plus.share.getServices(res => {
let sweixin = ""
for (var i = 0; i < res.length; i++) {
let t = res[i]
if (t.id == 'weixin') {
sweixin = t
}
}
if (sweixin) {
sweixin.launchMiniProgram({
id: "gh_150898128c00",
path: "/pages/index/index",
}, re => {
// 目标小程序点击返回app后执行的回调
let result = JSON.parse(re)
uni.switchTab({
url: "/pages/index/index"
})
console.log("目标小程序点击返回app后执行的回调")
},
err2 => {
console.log(err2)
})
} else {
uni.showToast({
title: "当前环境不支持跳转商城",
icon: 'none',
duration: 3000
})
setTimeout(function() {
uni.switchTab({
url: "/pages/index/index"
})
}, 500)
}
})
// #endif
},
onLoad() {
},
methods: {}
}
</script>
<style scoped lang="scss">
</style>