//public是对axios的工具类封装,定义了http请求方法
import http from
'
./../../../base/api/public
'
export const page_list
=
(page,size,params)
=
> {
return http
.requestQuickGet(
'
http://localhost:31001/cms/page/list/
'
+page+
'
/
'
+size)
}
import*as cmsApi from'../api/cms'
//查询
query:function () {
cmsApi.
page_list(this.
params.
page,this.
params.size,this.
params)
.then((res)
=
>{
console.log(res)
this.total = res.
queryResult.total
this.list
= res.
queryResult.list
})
}
//public是对axios的工具类封装,定义了http请求方法
import http from
'
./../../../base/api/public
'
let sysConfig
= require(
'
@/../config/sysConfig
'
)
let apiUrl =
sysConfig
.xcApiUrlPre;
export const page_list
=
(page,size,params)
=
> {
return http
.requestQuickGet(apiUrl+
'
/cms/page/list/
'
+page+
'
/
'
+size)
}
'
/api/cms
'
: {
target:
'
http://localhost:31001
'
,
pathRewrite: {
'^
/api
'
:
''
//实际请求去掉/api
}
<el
‐
pagination
layout
=
"
prev, pager, next
"
:page
‐
size
=
"
this.
params.size
"
v
‐
on:current
‐
change
=
"
changePage
"
:total=
"
total
"
:current
‐
page
=
"
this.
params.
page
"
style
=
"
float:right;
"
>
</el
‐
pagination>
data() {
return {
list:[],
total:50,
params:{
page:1,//页码
size:2//每页显示个数
}
}
//分页查询,接收page页码
changePage(page){
this.
params.
page
=
page;
this.
query()
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |