Node.js/nuxt/asyncData:修订间差异
来自康健生活
| (未显示同一用户的4个中间版本) | |||
| 第2行: | 第2行: | ||
asyncData 参数只在页面组件中有效。 | asyncData 参数只在页面组件中有效。 | ||
且第一次加载是服务端渲染,当在页面中再一次使用路由跳转到当前页面时(更换路由参数),则 HTTP 交互为浏览器客户端渲染 | |||
== ctx == | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
asyncData (ctx) { | asyncData (ctx) { | ||
// todo | // todo | ||
},</syntaxhighlight> | },</syntaxhighlight> | ||
{ | {| class="wikitable" | ||
|- | |||
| | |||
* $axios: (...) | * $axios: (...) | ||
* $config: (...) | * $config: (...) | ||
| 第45行: | 第49行: | ||
* next: ƒ () | * next: ƒ () | ||
* nuxtState: {layout: "default", data: Array(1), fetch: Array(0), error: null, state: {…}, …} | * nuxtState: {layout: "default", data: Array(1), fetch: Array(0), error: null, state: {…}, …} | ||
* params: {id: "22", bid: 0, title: "嘻嘻嘻", image: "http://static.askgo.cn/resource/intro/img/093fb01727e34dbaa230882edfbf4f1e.png"} | * params: {id: "22", bid: 0, title: "嘻嘻嘻", image: "<nowiki>http://static.askgo.cn/resource/intro/img/093fb01727e34dbaa230882edfbf4f1e.png</nowiki>"} | ||
* payload: undefined | * payload: undefined | ||
* query: {} | * query: {} | ||
| 第54行: | 第58行: | ||
* _redirected: false | * _redirected: false | ||
* __proto__: Object | * __proto__: Object | ||
} | |} | ||
==== 详细 ==== | ==== 详细 ==== | ||
---> [[/asyncdata详细内容|asyncdata详细内容]] | ---> [[/asyncdata详细内容|asyncdata详细内容]] | ||