Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sample
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周韬
node-sample
Commits
8255a01b
Commit
8255a01b
authored
Apr 22, 2017
by
Evan You
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetchData -> asyncData
parent
0253ebcc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
7 deletions
+7
-7
entry-client.js
src/entry-client.js
+3
-3
entry-server.js
src/entry-server.js
+1
-1
CreateListView.js
src/views/CreateListView.js
+1
-1
ItemView.vue
src/views/ItemView.vue
+1
-1
UserView.vue
src/views/UserView.vue
+1
-1
No files found.
src/entry-client.js
View file @
8255a01b
...
...
@@ -5,9 +5,9 @@ import { createApp } from './app'
// a global mixin to invoke fetchData on the client
Vue
.
mixin
({
beforeMount
()
{
const
{
fetch
Data
}
=
this
.
$options
if
(
fetch
Data
)
{
this
.
dataPromise
=
fetch
Data
(
const
{
async
Data
}
=
this
.
$options
if
(
async
Data
)
{
this
.
dataPromise
=
async
Data
(
this
.
$store
,
this
.
$route
)
...
...
src/entry-server.js
View file @
8255a01b
...
...
@@ -27,7 +27,7 @@ export default context => {
// which is resolved when the action is complete and store state has been
// updated.
Promise
.
all
(
matchedComponents
.
map
(
component
=>
{
return
component
.
fetchData
&&
component
.
fetch
Data
(
return
component
.
asyncData
&&
component
.
async
Data
(
store
,
router
.
currentRoute
,
context
...
...
src/views/CreateListView.js
View file @
8255a01b
...
...
@@ -10,7 +10,7 @@ export default function createListView (type) {
return
{
name
:
`
${
type
}
-stories-view`
,
fetch
Data
(
store
,
route
,
context
)
{
async
Data
(
store
,
route
,
context
)
{
return
store
.
dispatch
(
'FETCH_LIST_DATA'
,
{
type
}).
then
(()
=>
{
setTitle
(
camelize
(
type
),
context
)
})
...
...
src/views/ItemView.vue
View file @
8255a01b
...
...
@@ -46,7 +46,7 @@ export default {
}
},
fetch
Data
(
store
,
{
params
:
{
id
}},
context
)
{
async
Data
(
store
,
{
params
:
{
id
}},
context
)
{
return
store
.
dispatch
(
'FETCH_ITEMS'
,
{
ids
:
[
id
]
}).
then
(()
=>
{
const
item
=
store
.
state
.
items
[
id
]
setTitle
(
item
.
title
,
context
)
...
...
src/views/UserView.vue
View file @
8255a01b
...
...
@@ -30,7 +30,7 @@ export default {
}
},
fetch
Data
(
store
,
{
params
:
{
id
}},
context
)
{
async
Data
(
store
,
{
params
:
{
id
}},
context
)
{
return
store
.
dispatch
(
'FETCH_USER'
,
{
id
}).
then
(()
=>
{
const
user
=
store
.
state
.
users
[
id
]
setTitle
(
user
.
id
,
context
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment