pages.json
{
"path": "pages/index",
"style": {
"navigationBarTitleText": "uni-app",
"app-plus": {
"subNVues": [
{
"id": "nvue",
"path": "pages/nvue",
"type": "popup",
"style": {
"position": "absolute",
"bottom": "0",
"height": "60%"
}
}
]
}
}
}
pages/index
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<button @click="show" class="title">显示弹框</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
show () {
uni.getSubNVueById('nvue').show('slide-in-top')
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
pages/nvue.nvue
<template>
<view style="display: flex;flex-direction: column;">
<uni-nav-bar dark color="#999" background-color="#f5f5f5" shadow right-icon="clear" left-icon="left" title="hello" />
<web-view :fullscreen="false" :update-title="false" :webview-styles="{progress: false}" src="http://www.baidu.com" :style="webviewStyles"></web-view>
</view>
</template>
<script>
const sysInfo = uni.getSystemInfoSync()
export default {
computed: {
webviewStyles () {
return {
height: (sysInfo.windowHeight * 0.6 - 40) + 'px'
}
}
}
}
</script>
<style>
</style>