看来不上代码不行!
A页面
<template>
<view>
<view >
<button type="primary" @tap="toPage">toB</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onNavigationBarButtonTap() {
uni.showToast({
title:'A'
})
},
onLoad() {
},
methods: {
toPage(){
const pages = getCurrentPages();
if (pages.length > 1) {
plus.webview.show(pages[1].$getAppWebview().id,'none',0,() => {
plus.webview.hide(pages[0].$getAppWebview().id)
})
}
else {
uni.navigateTo({
url:'/pages/index/new_file'
})
}
}
}
}
</script>
<style>
</style>
B页面
<template>
<view>
<view >
<button type="primary" @tap="toPage">toA</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onNavigationBarButtonTap() {
uni.showToast({
title:'B'
})
},
onLoad() {
},
methods: {
toPage(){
const pages = getCurrentPages();
if (pages.length > 1) {
plus.webview.show(pages[0].$getAppWebview().id,'none',0,() => {
plus.webview.hide(pages[1].$getAppWebview().id)
})
}
else {
uni.navigateTo({
url:'/pages/index/new_file'
})
}
}
}
}
</script>
<style>
</style>
2 个回复
x***@qq.com - 疑问?的小纳?
有截图或代码示例吗
DCMarvel (作者)
看来不上代码不行!
A页面
B页面
DCloud_uniCloud_WYQ
为什么要用这种写法,uni-app里面自行管理webview是不推荐的
2020-04-13 20:58
DCMarvel (作者)
回复 DCloud_uniCloud_WYQ: 哦,不推荐的啊.那算了,如果没问题,uni-app 可以用VUE 随意写tabbar . 模拟显示,隐藏.都写完了,结果测试按钮有问题.tabbar可以起飞! 哈哈
2020-04-14 12:28