uni-app condition启动模式配置

tech2022-08-04  175

一 点睛

通过启动模式配置可以在开发时直达要进入的页面。本例通过 condition 配置,直达详情页。

二 代码

1 新增 detail.vue 详情页

<template> <view>详情页</view> </template> <script> </script> <style> </style>

2 pages.json 中配置condition

{ "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages { "path": "pages/message/message", "style":{ "navigationBarTitleText":"信息页", "navigationBarBackgroundColor":"#007AFF", "h5":{ "pullToRefresh":{ "color":"#7D26CD" } } } }, { "path": "pages/index/index" }, { "path": "pages/contact/contact" }, { "path": "pages/detail/detail" } ], "globalStyle": { "navigationBarTextStyle": "white", "navigationBarTitleText": "绿帽子", "navigationBarBackgroundColor": "#7FFF00", "backgroundColor": "#7CCD7C", "enablePullDownRefresh": true, "backgroundTextStyle":"light" }, "tabBar":{ "color":"#F0AD4E", "selectedColor":"#4CD964", "backgroundColor":"#007AFF", "borderStyle":"black", "list":[ { "text":"首页", "pagePath":"pages/index/index", "iconPath":"static/tabs/1237644.png", "selectedIconPath":"static/tabs/1237719.png" }, { "text":"信息页", "pagePath":"pages/message/message", "iconPath":"static/tabs/1246271.png", "selectedIconPath":"static/tabs/1262419.png" }, { "text":"我们", "pagePath":"pages/contact/contact", "iconPath":"static/tabs/1262419.png", "selectedIconPath":"static/tabs/1289167.png" } ] }, "condition":{ "current":0, "list":[ { "name":"详情页", "path":"pages/detail/detail", "query":"id=80" } ] } }

三 测试

 

最新回复(0)