Node.js/nuxt/asyncData/asyncdata详细内容:修订间差异
来自康健生活
创建页面,内容为“== 引言 == == ctx == <syntaxhighlight lang="javascript"> <ref *2> {…” |
|||
| 第790行: | 第790行: | ||
'$errorHandler': [Function (anonymous)] | '$errorHandler': [Function (anonymous)] | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
== app == | |||
== other == | |||
2020年10月7日 (三) 05:03的版本
引言
ctx
<ref *2> { 17:15:57
isStatic: false,
isDev: true,
isHMR: false,
app: <ref *1> {
head: {
title: 'askgo',
meta: [Array],
script: [Array],
__dangerouslyDisableSanitizers: [Array],
link: [Array],
style: [Array]
},
store: Store {
_committing: false,
_actions: [Object: null prototype],
_actionSubscribers: [],
_mutations: [Object: null prototype],
_wrappedGetters: [Object: null prototype] {},
_modules: [ModuleCollection],
_modulesNamespaceMap: [Object: null prototype],
_subscribers: [],
_watcherVM: [Vue],
_makeLocalGettersCache: [Object: null prototype],
dispatch: [Function: boundDispatch],
commit: [Function: boundCommit],
strict: true,
getters: {},
_vm: [Vue],
'$router': [VueRouter],
registerModule: [Function (anonymous)],
app: [Circular *1],
'$config': {},
'$cookies': [Object],
'$axios': [Function]
},
router: VueRouter {
app: [Vue],
apps: [Array],
options: [Object],
beforeHooks: [],
resolveHooks: [],
afterHooks: [],
matcher: [Object],
fallback: true,
mode: 'abstract',
history: [AbstractHistory]
},
nuxt: {
defaultTransition: [Object],
transitions: [Array],
setTransitions: [Function: setTransitions],
err: null,
dateErr: null,
error: [Function: error]
},
render: [Function: render],
data: [Function: data],
beforeCreate: [Function: beforeCreate],
created: [Function: created],
mounted: [AsyncFunction: mounted],
watch: {
'nuxt.err': 'errorChanged'
},
computed: {
isOffline: [Function: isOffline],
isFetching: [Function: isFetching]
},
methods: {
refreshOnlineStatus: [Function: refreshOnlineStatus],
refresh: [AsyncFunction: refresh],
errorChanged: [Function: errorChanged],
setLayout: [Function: setLayout],
loadLayout: [Function: loadLayout]
},
components: {
NuxtLoading: [Object]
},
context: [Circular *2],
'$config': {},
'$cookies': {
parseJSON: true,
set: [Function: set],
setAll: [Function: setAll],
get: [Function: get],
getAll: [Function: getAll],
remove: [Function: remove],
removeAll: [Function: removeAll],
nodeCookie: [Object]
},
'$axios': [Function: wrap] {
request: [Function: wrap],
getUri: [Function: wrap],
delete: [Function: wrap],
get: [Function: wrap],
head: [Function: wrap],
options: [Function: wrap],
post: [Function: wrap],
put: [Function: wrap],
patch: [Function: wrap],
defaults: [Object],
interceptors: [Object],
CancelToken: [Function],
isCancel: [Function: isCancel],
setBaseURL: [Function: bound setBaseURL],
setHeader: [Function: bound setHeader],
setToken: [Function: bound setToken],
onRequest: [Function: bound onRequest],
onResponse: [Function: bound onResponse],
onRequestError: [Function: bound onRequestError],
onResponseError: [Function: bound onResponseError],
onError: [Function: bound onError],
create: [Function: bound create],
'$request': [Function: bound ],
'$delete': [Function: bound ],
'$get': [Function: bound ],
'$head': [Function: bound ],
'$options': [Function: bound ],
'$post': [Function: bound ],
'$put': [Function: bound ],
'$patch': [Function: bound ]
}
},
store: <ref *5> Store {
_committing: false,
_actions: [Object: null prototype] {
nuxtServerInit: [Array],
'file/initFile': [Array],
'file/setFile': [Array],
'file/getFile': [Array],
'file/deleteFile': [Array],
'file/updateFileList': [Array],
'file/updatePhotoList': [Array],
'file/addFile': [Array],
'file/addPhoto': [Array],
'pagination/initPagination': [Array],
'pagination/setPagination': [Array],
'pagination/getPagination': [Array],
'user/setToken': [Array],
'user/setUserInfo': [Array],
'user/deleteToken': [Array]
},
_actionSubscribers: [],
_mutations: [Object: null prototype] {
'file/initFile': [Array],
'file/updateFile': [Array],
'file/addFile': [Array],
'file/addPhoto': [Array],
'file/deleteFile': [Array],
'file/getFile': [Array],
'pagination/initPagination': [Array],
'pagination/updatePagination': [Array],
'pagination/getPagination': [Array],
'user/updateToken': [Array],
'user/updateUserInfo': [Array],
'user/deleteToken': [Array],
'user/getToken': [Array]
},
_wrappedGetters: [Object: null prototype] {},
_modules: ModuleCollection {
root: [Module]
},
_modulesNamespaceMap: [Object: null prototype] {
'file/': [Module],
'pagination/': [Module],
'user/': [Module]
},
_subscribers: [],
_watcherVM: <ref *3> Vue {
_uid: 15173,
_isVue: true,
'$options': [Object],
_renderProxy: [Circular *3],
_self: [Circular *3],
'$parent': undefined,
'$root': [Circular *3],
'$children': [],
'$refs': {},
_watcher: null,
_inactive: null,
_directInactive: false,
_isMounted: false,
_isDestroyed: false,
_isBeingDestroyed: false,
_events: [Object: null prototype],
_hasHookEvent: true,
_vnode: null,
_staticTrees: null,
'$vnode': undefined,
'$slots': {},
'$scopedSlots': {},
_c: [Function (anonymous)],
'$createElement': [Function (anonymous)],
'$attrs': [Getter/Setter],
'$listeners': [Getter/Setter],
_routerRoot: [Circular *3],
_watchers: [],
'$seo': [Function: bound $seo],
_data: {}
},
_makeLocalGettersCache: [Object: null prototype] {
'user/': {}
},
dispatch: [Function: boundDispatch],
commit: [Function: boundCommit],
strict: true,
getters: {},
_vm: <ref *4> Vue {
_uid: 15174,
_isVue: true,
'$options': [Object],
_renderProxy: [Circular *4],
_self: [Circular *4],
'$parent': undefined,
'$root': [Circular *4],
'$children': [],
'$refs': {},
_watcher: null,
_inactive: null,
_directInactive: false,
_isMounted: false,
_isDestroyed: false,
_isBeingDestroyed: false,
_events: [Object: null prototype],
_hasHookEvent: true,
_vnode: null,
_staticTrees: null,
'$vnode': undefined,
'$slots': {},
'$scopedSlots': {},
_c: [Function (anonymous)],
'$createElement': [Function (anonymous)],
'$attrs': [Getter/Setter],
'$listeners': [Getter/Setter],
_routerRoot: [Circular *4],
_watchers: [Array],
'$seo': [Function: bound $seo],
_data: [Object],
_computedWatchers: [Object: null prototype] {}
},
'$router': VueRouter {
app: [Vue],
apps: [Array],
options: [Object],
beforeHooks: [],
resolveHooks: [],
afterHooks: [],
matcher: [Object],
fallback: true,
mode: 'abstract',
history: [AbstractHistory]
},
registerModule: [Function (anonymous)],
app: <ref *1> {
head: [Object],
store: [Circular *5],
router: [VueRouter],
nuxt: [Object],
render: [Function: render],
data: [Function: data],
beforeCreate: [Function: beforeCreate],
created: [Function: created],
mounted: [AsyncFunction: mounted],
watch: [Object],
computed: [Object],
methods: [Object],
components: [Object],
context: [Circular *2],
'$config': {},
'$cookies': [Object],
'$axios': [Function]
},
'$config': {},
'$cookies': {
parseJSON: true,
set: [Function: set],
setAll: [Function: setAll],
get: [Function: get],
getAll: [Function: getAll],
remove: [Function: remove],
removeAll: [Function: removeAll],
nodeCookie: [Object]
},
'$axios': [Function: wrap] {
request: [Function: wrap],
getUri: [Function: wrap],
delete: [Function: wrap],
get: [Function: wrap],
head: [Function: wrap],
options: [Function: wrap],
post: [Function: wrap],
put: [Function: wrap],
patch: [Function: wrap],
defaults: [Object],
interceptors: [Object],
CancelToken: [Function],
isCancel: [Function: isCancel],
setBaseURL: [Function: bound setBaseURL],
setHeader: [Function: bound setHeader],
setToken: [Function: bound setToken],
onRequest: [Function: bound onRequest],
onResponse: [Function: bound onResponse],
onRequestError: [Function: bound onRequestError],
onResponseError: [Function: bound onResponseError],
onError: [Function: bound onError],
create: [Function: bound create],
'$request': [Function: bound ],
'$delete': [Function: bound ],
'$get': [Function: bound ],
'$head': [Function: bound ],
'$options': [Function: bound ],
'$post': [Function: bound ],
'$put': [Function: bound ],
'$patch': [Function: bound ]
}
},
payload: undefined,
error: [Function: bound error],
base: '/',
env: {
host: {
proxyTable: [Object],
staticHost: '/_nuxt/',
cloudStaticHost: 'http://static.askgo.cn'
},
target: 'development',
SECRET: 'kangkk'
},
req: IncomingMessage {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList {
head: null,
tail: null,
length: 0
},
length: 0,
pipes: [],
flowing: null,
ended: true,
endEmitted: false,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
errored: false,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: null
},
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: [Server],
_server: [Server],
parser: [HTTPParser],
on: [Function: socketListenerWrap],
addListener: [Function: socketListenerWrap],
prependListener: [Function: socketListenerWrap],
_paused: false,
_peername: [Object],
_httpMessage: [ServerResponse],
[Symbol(async_id_symbol)]: 2692561,
[Symbol(kHandle)]: [TCP],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
httpVersionMajor: 1,
httpVersionMinor: 0,
httpVersion: '1.0',
complete: true,
headers: {
host: 'localnode.askgo.cn',
'x-real-ip': '192.168.1.106',
'x-forwarded-for': '192.168.1.106',
'x-forwarded-proto': 'http',
connection: 'close',
'cache-control': 'max-age=0',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36',
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-encoding': 'gzip, deflate',
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
cookie: '__utma=177498040.1679460846.1599620867.1599620867.1599620867.1; __utmz=177498040.1599620867.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); x-token=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOjEwMDAxMjIsImNyZWF0ZWQiOjE2MDA3NjYwOTIxNjksImV4cCI6MTYwMDc3MzI5Mn0.JsPyJt54WwTShD_sFrIe6sk4ZH7QvP5DWY2JtuXY3WseBDXipuDeVmuVE0envMnaO4WirkHUjV6R4Zm75z0Wvg'
},
rawHeaders: [
'Host',
'localnode.askgo.cn',
'X-Real-IP',
'192.168.1.106',
'X-Forwarded-For',
'192.168.1.106',
'X-Forwarded-Proto',
'http',
'Connection',
'close',
'Cache-Control',
'max-age=0',
'Upgrade-Insecure-Requests',
'1',
'User-Agent',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36',
'Accept',
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Accept-Encoding',
'gzip, deflate',
'Accept-Language',
'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
'Cookie',
'__utma=177498040.1679460846.1599620867.1599620867.1599620867.1; __utmz=177498040.1599620867.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); x-token=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOjEwMDAxMjIsImNyZWF0ZWQiOjE2MDA3NjYwOTIxNjksImV4cCI6MTYwMDc3MzI5Mn0.JsPyJt54WwTShD_sFrIe6sk4ZH7QvP5DWY2JtuXY3WseBDXipuDeVmuVE0envMnaO4WirkHUjV6R4Zm75z0Wvg'
],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '/pay/statement',
method: 'GET',
statusCode: null,
statusMessage: null,
client: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: [Server],
_server: [Server],
parser: [HTTPParser],
on: [Function: socketListenerWrap],
addListener: [Function: socketListenerWrap],
prependListener: [Function: socketListenerWrap],
_paused: false,
_peername: [Object],
_httpMessage: [ServerResponse],
[Symbol(async_id_symbol)]: 2692561,
[Symbol(kHandle)]: [TCP],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_consuming: false,
_dumped: false,
originalUrl: '/pay/statement',
_parsedUrl: Url {
protocol: null,
slashes: null,
auth: null,
host: null,
port: null,
hostname: null,
hash: null,
search: null,
query: null,
pathname: '/pay/statement',
path: '/pay/statement',
href: '/pay/statement',
_raw: '/pay/statement'
},
_parsedOriginalUrl: Url {
protocol: null,
slashes: null,
auth: null,
host: null,
port: null,
hostname: null,
hash: null,
search: null,
query: null,
pathname: '/pay/statement',
path: '/pay/statement',
href: '/pay/statement',
_raw: '/pay/statement'
},
[Symbol(kCapture)]: false
},
res: <ref *6> ServerResponse {
_events: [Object: null prototype] {
finish: [Function: bound resOnFinish]
},
_eventsCount: 1,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: true,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: false,
_headerSent: false,
socket: Socket {
connecting: false,
_hadError: false,
_parent: null,
_host: null,
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: [Server],
_server: [Server],
parser: [HTTPParser],
on: [Function: socketListenerWrap],
addListener: [Function: socketListenerWrap],
prependListener: [Function: socketListenerWrap],
_paused: false,
_peername: [Object],
_httpMessage: [Circular *6],
[Symbol(async_id_symbol)]: 2692561,
[Symbol(kHandle)]: [TCP],
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
_header: null,
_onPendingData: [Function: bound updateOutgoingData],
_sent100: false,
_expect_continue: false,
timing: ServerTiming {
_times: [Map],
headers: []
},
writeHead: [Function: writeHead],
locals: {},
statusCode: 200,
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: null
},
ssrContext: {
req: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
socket: [Socket],
httpVersionMajor: 1,
httpVersionMinor: 0,
httpVersion: '1.0',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '/pay/statement',
method: 'GET',
statusCode: null,
statusMessage: null,
client: [Socket],
_consuming: false,
_dumped: false,
originalUrl: '/pay/statement',
_parsedUrl: [Url],
_parsedOriginalUrl: [Url],
[Symbol(kCapture)]: false
},
res: <ref *6> ServerResponse {
_events: [Object: null prototype],
_eventsCount: 1,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: true,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: false,
_headerSent: false,
socket: [Socket],
_header: null,
_onPendingData: [Function: bound updateOutgoingData],
_sent100: false,
_expect_continue: false,
timing: [ServerTiming],
writeHead: [Function: writeHead],
locals: {},
statusCode: 200,
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: null
},
url: '/pay/statement',
target: 'server',
spa: undefined,
modern: false,
runtimeConfig: {
private: {},
public: {}
},
_registeredComponents: Set(0) {},
styles: [Getter],
_renderStyles: [Function: renderStyles],
_styles: {
'730a5f4a:0': [Object],
'7f914dc6:0': [Object]
},
redirected: false,
next: [Function (anonymous)],
beforeRenderFns: [],
nuxt: {
layout: 'default',
data: [],
fetch: [],
error: null,
state: null,
serverRendered: true,
routePath: '/pay/statement',
config: {}
},
meta: {
getOptions: [Function: getOptions$1],
setOptions: [Function: setOptions],
refresh: [Function: refresh$1],
inject: [Function: inject$1],
pause: [Function: pause$1],
resume: [Function: resume$1],
addApp: [Function: addApp$1]
},
asyncData: {}
},
redirect: [Function (anonymous)],
beforeNuxtRender: [Function (anonymous)],
route: {
name: '/pay/statement',
meta: [
{}
],
path: '/pay/statement',
hash: '',
query: {},
params: {},
fullPath: '/pay/statement',
matched: [
[Object]
]
},
next: [Function (anonymous)],
_redirected: false,
_errored: false,
params: {},
query: {},
'$config': {},
'$cookies': {
parseJSON: true,
set: [Function: set],
setAll: [Function: setAll],
get: [Function: get],
getAll: [Function: getAll],
remove: [Function: remove],
removeAll: [Function: removeAll],
nodeCookie: {
parse: [Function: o],
serialize: [Function: n]
}
},
'$axios': [Function: wrap] {
request: [Function: wrap],
getUri: [Function: wrap],
delete: [Function: wrap],
get: [Function: wrap],
head: [Function: wrap],
options: [Function: wrap],
post: [Function: wrap],
put: [Function: wrap],
patch: [Function: wrap],
defaults: {
headers: [Object],
baseURL: 'http://localhost:3000/',
transformRequest: [Array],
transformResponse: [Array],
timeout: 3000,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
retry: 3,
retryDelay: 2000
},
interceptors: {
request: [InterceptorManager],
response: [InterceptorManager]
},
CancelToken: [Function: CancelToken] {
source: [Function: source]
},
isCancel: [Function: isCancel],
setBaseURL: [Function: bound setBaseURL],
setHeader: [Function: bound setHeader],
setToken: [Function: bound setToken],
onRequest: [Function: bound onRequest],
onResponse: [Function: bound onResponse],
onRequestError: [Function: bound onRequestError],
onResponseError: [Function: bound onResponseError],
onError: [Function: bound onError],
create: [Function: bound create],
'$request': [Function: bound ],
'$delete': [Function: bound ],
'$get': [Function: bound ],
'$head': [Function: bound ],
'$options': [Function: bound ],
'$post': [Function: bound ],
'$put': [Function: bound ],
'$patch': [Function: bound ]
},
'$errorHandler': [Function (anonymous)]
}
app
other
No categories