<template>
<div>
修改用户信息{{id}},名称:{{name}}
</div>
</template>
<script>
export default{
layout:
'
test
'
,
//根据id查询用户信息
asyncData(){
console.log(
"
async方法
"
)
return {
name:
'
黑马程序员
'
}
},
data(){
return {
id:
''
}
},
mounted(){
this.id
=
this.
$route.
params.id;
}
}
</script>
<style>
</style>
methods:{
a(){
return new Promise(function(resolve,reject){
setTimeout(function () {
resolve(1)
},2000)
})
},
b(){
return new Promise(function(resolve,reject){
setTimeout(function () {
resolve(2)
},1000)
})
}
},
mounted(){
this.a()
.then(res
=
>{
alert(res)
console.log(res)
})
this.b()
.then(res
=
>{
alert(res)
console.log(res)
})
}
async asyncData({ store, route }) {
console.log(
"
async方法
"
)
var a
=
await new Promise(function (resolve, reject) {
setTimeout(function () {
console.log(
"
1
"
)
resolve(1)
},2000)
});
var a
=
await new Promise(function (resolve, reject) {
setTimeout(function () {
console.log(
"
2
"
)
resolve(2)
},1000)
});
return {
name:
'
黑马程序员
'
}
},
<template>
<div>
<Header />
<nuxt/>
<Footer />
</div>
</template>
<script>
import Footer from
'
../components/Footer.vue
'
import Header from
'
../components/Header.vue
'
export default {
components: {
Header,
Footer
}
}
</script>
<style>
</style>
#静态资源,包括系统所需要的图片,js、css等静态资源
location /static/img/ {
alias F:/develop/xc_portal_static/img/;
}
location /static/css/ {
alias F:/develop/xc_portal_static/css/;
}
location /static/js/ {
alias F:/develop/xc_portal_static/js/;
}
location /static/plugins/ {
alias F:/develop/xc_portal_static/plugins/;
add_header Access
‐
Control
‐
Allow
‐
Origin http://ucenter.xuecheng
.com;
add_header Access
‐
Control
‐
Allow
‐
Credentials true;
add_header Access
‐
Control
‐
Allow
‐
Methods GET;
}
#前端门户课程搜索
location
^~
/course/search {
proxy_pass http://dynamic_portal_server_pool;
}
#后端搜索服务
location /openapi/search/ {
proxy_pass http://search_server_pool/search/;
}
#分类信息
location /static/category/ {
proxy_pass http://static_server_pool;
}
#前端动态门户
upstream dynamic_portal_server_pool{
server 127.0.0.1:10000 weight
=10;
}
#后台搜索(公开api)
upstream search_server_pool{
server 127.0.0.1:40100 weight
=10;
}
#开发环境webpack定时加载此文件
location
^~
/__webpack_hmr {
proxy_pass http://dynamic_portal_server_pool/__webpack_hmr;
}
#开发环境nuxt访问_nuxt
location
^~
/_nuxt/ {
proxy_pass http://dynamic_portal_server_pool/_nuxt/;
}
#学成网静态资源
server {
listen 91;
server_name localhost;
#分类信息
location /static/category/ {
alias F:/develop/xuecheng/static/category/;
}
...
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |