@@ -4,9 +4,9 @@ Vue.config.silent = false
4
4
Vue . config . debug = true
5
5
6
6
const FrameRouter = function install ( Vue , options ) {
7
- const navigatorLog = ( ... args ) => {
7
+ const navigatorLog = args => {
8
8
if ( options . debug ) {
9
- console . log ( ... args )
9
+ console . log ( args )
10
10
}
11
11
}
12
12
@@ -62,7 +62,8 @@ const FrameRouter = function install(Vue, options) {
62
62
this . _setPending ( path , false , data )
63
63
const route = this . _getMatched ( path )
64
64
this . $navigateTo ( route . component , {
65
- frame : '__navigator_frame__'
65
+ frame : '__navigator_frame__' ,
66
+ path
66
67
} )
67
68
} ,
68
69
replace ( path , data ) {
@@ -74,7 +75,8 @@ const FrameRouter = function install(Vue, options) {
74
75
const route = this . _getMatched ( path )
75
76
this . $navigateTo ( route . component , {
76
77
frame : '__navigator_frame__' ,
77
- clearHistory : true
78
+ clearHistory : true ,
79
+ path
78
80
} )
79
81
} ,
80
82
back ( notify = false ) {
@@ -105,10 +107,8 @@ const FrameRouter = function install(Vue, options) {
105
107
} )
106
108
107
109
Vue . component ( 'FrameRouter' , {
108
- data ( ) {
109
- return {
110
- rendered : false
111
- }
110
+ created ( ) {
111
+ this . rendered = false
112
112
} ,
113
113
render ( h ) {
114
114
if ( ! this . rendered ) {
@@ -118,20 +118,24 @@ const FrameRouter = function install(Vue, options) {
118
118
return h (
119
119
'Frame' ,
120
120
{
121
- attrs : {
122
- id : '__navigator_frame__' ,
123
- ...this . $attrs ,
124
- ...this . $props
125
- } ,
126
- on : {
127
- back ( ) {
128
- navigator . back ( true )
121
+ attrs : Object . assign (
122
+ {
123
+ id : '__navigator_frame__'
129
124
} ,
130
- navigated ( ) {
131
- navigator . _confirmPathChange ( )
125
+ this . $attrs ,
126
+ this . $props
127
+ ) ,
128
+ on : Object . assign (
129
+ {
130
+ back ( ) {
131
+ navigator . back ( true )
132
+ } ,
133
+ navigated ( ) {
134
+ navigator . _confirmPathChange ( )
135
+ }
132
136
} ,
133
- ... this . $listeners
134
- }
137
+ this . $listeners
138
+ )
135
139
} ,
136
140
[ this . rendered ]
137
141
)
@@ -144,6 +148,7 @@ const HomePage = {
144
148
<Page>
145
149
<ActionBar title="Navigator Demo"/>
146
150
<GridLayout>
151
+ <!--<Button @tap="$navigator.push('/details')" text="Go to details" />-->
147
152
<ListView for="item in ['one', 'two', 'three']" @itemTap="$navigator.push('/details', { selected: $event.index })">
148
153
<v-template>
149
154
<Label :text="item" padding="20"/>
@@ -157,6 +162,7 @@ const HomePage = {
157
162
const DetailsPage = {
158
163
template : `
159
164
<Page>
165
+ <ActionBar title="Details Page"/>
160
166
<StackLayout>
161
167
<Label text="DetailsPage" />
162
168
<Label :text="JSON.stringify($navigator.data, null, 2)" textWrap="true" />
@@ -179,8 +185,8 @@ Vue.use(FrameRouter, {
179
185
180
186
new Vue ( {
181
187
template : `
182
- <GridLayout rows="*, auto, * ">
183
- <FrameRouter :transition="{ name: 'slide', duration: 1000 }" row="0"/>
188
+ <GridLayout rows="*, auto, auto ">
189
+ <FrameRouter row="0"/>
184
190
<label :text="$navigator.$data.path" row="1" />
185
191
<label :text="JSON.stringify($navigator.$data.stack, null, 2)" textWrap="true" row="2" />
186
192
</GridLayout>
0 commit comments