**pages.json**
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"enablePullDownRefresh": false,
"app-plus": {
"subNVues": [{
"id": "drawer",
"path": "pages/login/subNvue/login", // nvue 路径
"style": {
"zindex": 999
}
}
]
}
}
},
**login.vue**
<template>
<view>
<view></view>
</view>
</template>
<script>
export default {
data() {
return {};
},
onLoad() {
this.nvueShow();
},
methods: {
nvueShow() {
const subnvue = uni.getSubNVueById('drawer'); // 获取nvue
subnvue.show();
}
}
};
</script>
<style></style>
**login.nvue**
<template>
<view class="content">
<div class="test_box">
<text class="title">我是原生子窗体{{ number }}</text>
</div>
</view>
</template>
<script>
export default {
data() {
return {
number: 2
};
},
onLoad() {
console.log('nvue');
},
methods: {}
};
</script>
<style scoped>
.content {
display: flex;
}
.test_box {
flex: 1;
background-color: pink;
width: 750rpx;
height: 500rpx;
}
.title {
color: #333333;
}
</style>