uni-app學習記錄01-pages配置項


{
    // 每個頁面都需要在pages里面去聲明配置
    "pages": [ //pages數組中第一項表示應用啟動頁,參考:https://uniapp.dcloud.io/collocation/pages
        // 每頁里面的style的設置會覆蓋globalStyle里面的設置
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "首頁"
            }
        },
        {
            "path": "pages/one/one",
            "style": {
                "navigationBarTitleText": "一頁"
            }
        },
        {
            "path": "pages/two/two",
            "style": {
                "navigationBarTitleText": "二頁"
            }
        }, {
            "path": "pages/three/three",
            "style": {
                "navigationBarTitleText": "三頁"
            }
        }, {
            "path": "pages/four/four",
            "style": {
                "navigationBarTitleText": "四頁"
            }
        }
    ],
    // 通過配置tabBar來設置底部導航欄 最少2頁最多5頁
    "tabBar": {
        // tab 上的文字默認顏色
        "color": "#7A7E83",
        // selectedColor
        "selectedColor": "#3cc51f",
        // tabbar 上邊框的顏色,僅支持 black/white
        "borderStyle": "black",
        // tab 的背景色
        "backgroundColor": "#ffffff",
        // list 接收一個數組,數組中的每個項都是一個對象
        "list": [{
                // 頁面路徑,必須在 pages 中先定義
                "pagePath": "pages/index/index",
                // 圖片路徑,icon 大小限制為40kb,建議尺寸為 81px * 81px,當 postion 為 top 時,此參數無效,不支持網絡圖片,不支持字體圖標
                "iconPath": "static/icon_ck8ejdbukbf/aixin.png",
                // 選中時的圖片路徑,icon 大小限制為40kb,建議尺寸為 81px * 81px ,當 postion 為 top 時,此參數無效
                "selectedIconPath": "static/icon_yboweg9a00s/aixin.png",
                // tab 上按鈕文字,在 5+APP 和 H5 平台為非必填。例如中間可放一個沒有文字的+號圖標
                "text": "首頁"
            },
            {
                "pagePath": "pages/one/one",
                "iconPath": "static/icon_ck8ejdbukbf/aixin.png",
                "selectedIconPath": "static/icon_yboweg9a00s/aixin.png",
                "text": "一頁"
            },
            {
                "pagePath": "pages/two/two",
                "iconPath": "static/icon_ck8ejdbukbf/aixin.png",
                "selectedIconPath": "static/icon_yboweg9a00s/aixin.png",
                "text": "二頁"
            }, {
                "pagePath": "pages/three/three",
                "iconPath": "static/icon_ck8ejdbukbf/aixin.png",
                "selectedIconPath": "static/icon_yboweg9a00s/aixin.png",
                "text": "三頁"
            }, {
                "pagePath": "pages/four/four",
                "iconPath": "static/icon_ck8ejdbukbf/aixin.png",
                "selectedIconPath": "static/icon_yboweg9a00s/aixin.png",
                "text": "四頁"
            }
        ]
    },
    // 用於設置所有頁面的狀態欄,導航欄,標題,窗口背景等設置
    "globalStyle": {
        // 導航欄的樣式 
        "navigationBarTextStyle": "black",
        // 導航欄的標題文字內容
        "navigationBarTitleText": "uni-app",
        // 導航欄的背景顏色
        "navigationBarBackgroundColor": "#F8F8F8",
        // 窗口的背景色
        "backgroundColor": "#F8F8F8"
    }
    // 啟動模式配置,僅開發期間生效,用於模擬直達頁面的場景,如:小程序轉發后,用戶點擊所打開的頁面。
    /* "condition": { //模式配置,僅開發期間生效
        "current": 0, //當前激活的模式(list 的索引項)
        "list": [{
                "name": "swiper", //模式名稱
                "path": "pages/component/swiper/swiper", //啟動頁面,必選
                "query": "interval=4000&autoplay=false" //啟動參數,在頁面的onLoad函數里面得到。
            },
            {
                "name": "test",
                "path": "pages/component/switch/switch"
            }
        ]
    } */
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM