props route query to element

This commit is contained in:
daizhan 2018-11-22 16:32:50 +08:00
parent 421e8fbe15
commit 45300f709f
2 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@ define('my-app', class extends WeElement {
data = {
pageTitle: '',
routeParams: null,
routeQuery: null,
routeList: []
}
@ -26,7 +27,7 @@ define('my-app', class extends WeElement {
render(props, data) {
return (
<app-frame routeList={this.data.routeList}>
<this.data.tag slot="page-content" params={this.data.params} />
<this.data.tag slot="page-content" params={this.data.routeParams} query={this.data.routeQuery}/>
</app-frame>
)
}

View File

@ -8,6 +8,7 @@ export default function(omiElement) {
omiElement.data.pageTitle = item.label
omiElement.data.tag = item.tag
omiElement.data.routeParams = evt.params
omiElement.data.routeQuery = evt.query
routeList.forEach(routeItem => (routeItem.selected = false))
item.selected = true
})