Skip to content

Commit 8f0d4c2

Browse files
committed
fix: ios Frame, and replace ... operator
1 parent 2a47b3e commit 8f0d4c2

File tree

2 files changed

+34
-28
lines changed

2 files changed

+34
-28
lines changed

samples/app/app-with-ns-router.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Vue.config.silent = false
44
Vue.config.debug = true
55

66
const FrameRouter = function install(Vue, options) {
7-
const navigatorLog = (...args) => {
7+
const navigatorLog = args => {
88
if (options.debug) {
9-
console.log(...args)
9+
console.log(args)
1010
}
1111
}
1212

@@ -62,7 +62,8 @@ const FrameRouter = function install(Vue, options) {
6262
this._setPending(path, false, data)
6363
const route = this._getMatched(path)
6464
this.$navigateTo(route.component, {
65-
frame: '__navigator_frame__'
65+
frame: '__navigator_frame__',
66+
path
6667
})
6768
},
6869
replace(path, data) {
@@ -74,7 +75,8 @@ const FrameRouter = function install(Vue, options) {
7475
const route = this._getMatched(path)
7576
this.$navigateTo(route.component, {
7677
frame: '__navigator_frame__',
77-
clearHistory: true
78+
clearHistory: true,
79+
path
7880
})
7981
},
8082
back(notify = false) {
@@ -105,10 +107,8 @@ const FrameRouter = function install(Vue, options) {
105107
})
106108

107109
Vue.component('FrameRouter', {
108-
data() {
109-
return {
110-
rendered: false
111-
}
110+
created() {
111+
this.rendered = false
112112
},
113113
render(h) {
114114
if (!this.rendered) {
@@ -118,20 +118,24 @@ const FrameRouter = function install(Vue, options) {
118118
return h(
119119
'Frame',
120120
{
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__'
129124
},
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+
}
132136
},
133-
...this.$listeners
134-
}
137+
this.$listeners
138+
)
135139
},
136140
[this.rendered]
137141
)
@@ -144,6 +148,7 @@ const HomePage = {
144148
<Page>
145149
<ActionBar title="Navigator Demo"/>
146150
<GridLayout>
151+
<!--<Button @tap="$navigator.push('/details')" text="Go to details" />-->
147152
<ListView for="item in ['one', 'two', 'three']" @itemTap="$navigator.push('/details', { selected: $event.index })">
148153
<v-template>
149154
<Label :text="item" padding="20"/>
@@ -157,6 +162,7 @@ const HomePage = {
157162
const DetailsPage = {
158163
template: `
159164
<Page>
165+
<ActionBar title="Details Page"/>
160166
<StackLayout>
161167
<Label text="DetailsPage" />
162168
<Label :text="JSON.stringify($navigator.data, null, 2)" textWrap="true" />
@@ -179,8 +185,8 @@ Vue.use(FrameRouter, {
179185

180186
new Vue({
181187
template: `
182-
<GridLayout rows="*, auto, *">
183-
<FrameRouter :transition="{ name: 'slide', duration: 1000 }" row="0"/>
188+
<GridLayout rows="*, auto, auto">
189+
<FrameRouter row="0"/>
184190
<label :text="$navigator.$data.path" row="1" />
185191
<label :text="JSON.stringify($navigator.$data.stack, null, 2)" textWrap="true" row="2" />
186192
</GridLayout>

samples/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
"repository": "<fill-your-repository-here>",
66
"nativescript": {
77
"id": "org.nativescript.vuesample",
8-
"tns-ios": {
9-
"version": "4.0.1"
10-
},
118
"tns-android": {
12-
"version": "4.0.1"
9+
"version": "4.2.0-2018-07-20-02"
10+
},
11+
"tns-ios": {
12+
"version": "4.2.0-2018-07-17-01"
1313
}
1414
},
1515
"dependencies": {
1616
"nativescript-gradient": "^2.0.1",
1717
"nativescript-pager": "^7.1.3",
1818
"nativescript-theme-core": "^1.0.4",
1919
"nativescript-ui-sidedrawer": "^4.1.1",
20-
"tns-core-modules": "4.0.0",
20+
"tns-core-modules": "4.1.1",
2121
"vue-router": "^3.0.1",
2222
"vuex": "^3.0.1"
2323
},
@@ -28,4 +28,4 @@
2828
"lazy": "^1.0.11",
2929
"nativescript-dev-android-snapshot": "^0.0.11"
3030
}
31-
}
31+
}

0 commit comments

Comments
 (0)