原生子窗体

2022-02-18  本文已影响0人  苍老师的眼泪
  1. 定义子窗体(pages/home/subNvue/hello.nvue):
<template>
    <!-- 文字的话就用text,用view的话样式无效 -->
    <text class="hello">
        我是子窗体
    </text>
</template>

<style>
    .hello {
        font-size: 36px; 
        color: red; 
    }
</style>  
  1. 配置pages.json
{
    "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
        {
            "path": "pages/home/home",
            "style": {
                "navigationBarTitleText": "首页", 
                "enablePullDownRefresh": true,
                "app-plus": {
                    "titleNView": false, // 设置为true的话,子窗体会使用导航栏的空间!!
                    "subNVues":[ 
                        { 
                        "id": "hello", 
                        "path": "pages/home/subNvue/hello",  
                        "style": {
    
                                "position": "absolute",
                                // "width": "100px",
                                "height": "100px",
                                "left":"20px",
                                "top":"20px",
                                "background": "transparent"  
                        }
                     
                    }]
                } 
            }
        },
上一篇 下一篇

猜你喜欢

热点阅读