路由包裹组件
基于框架上层封装,基于应用框架现有功能,要求组件树层级中,在渲染时,组件树中只允许存在嵌套关系的router-view,不允许两个router-view在同一层级中出现,如:
//错误使用方式 <view> <router-view /> <router-view /> </view> //component-a <view> <router-view /> </view> //component-b <view> <router-view /> </view> <view> <component-a /> //会导致错误,因两个router-view组件不是嵌套关系 <component-b /> </view>
{ "component": true, "usingComponents": { "router-view": "miniapp-router/router-view/router-view", } }
<view> <view class="content-main-container" > <router-view> <button slot="button" /> <slider slot="slider" /> <icon slot="icon" /> <text slot="text" /> <progress slot="progress" /> <menu slot="menu" /> <select slot="select" /> <textarea slot="textarea" /> <input slot="input" /> <checkbox slot="checkbox" /> <switch slot="switch" /> <radio slot="radio" /> <pagination slot="pagination" /> <date-picker slot="date-picker" /> <menu-button slot="menu-button" /> <table slot="table" /> </router-view> </view> </view>