springboot + vue separó extremos delantero y trasero
Uso de acceso frontal resorte vue api de nuevo arranque, acceso a varios dominios, frente separada y extremos traseros.
JSON proporcionar datos sobre los antecedentes
importación com.ftest.springboot.entity.Area; importación com.ftest.springboot.repository.CgRepository; importación org.springframework.beans.factory.annotation.Autowired; importación org.springframework.data.domain.Page; importación org.springframework.data.domain.PageRequest; importación org.springframework.web.bind.annotation.GetMapping; importación org.springframework.web.bind.annotation.PathVariable; importación org.springframework.web.bind.annotation.RequestMapping; importación org.springframework.web.bind.annotation.RestController; importación java.util.List; @RestController @RequestMapping ( "/ cg") Pública clase AreaController { @Autowired privada CgRepository cgRepository; @GetMapping ( "/ findall" ) pública Lista <Área> findAll () { volver cgRepository.findAll (); } @GetMapping ( "/ findall / {página} / {tamaño}" ) pública Página <Área> findAll1 (@PathVariable int página, @PathVariable int tamaño) { PageRequest solicitar = PageRequest.of (página, tamaño); retorno cgRepository.findAll (petición); } }
receptor de front-end
datos () {
retorno {
PageSize: '', //分页页码
total: '', //总数
TableData: [] //数据
}
},
creado () {
const _Está = esta;
axios.get ( 'http: // localhost: 8888 / cg / findall /' + '0' + '/ 10') .then (función (resp) {
_this.tableData = resp.data.content
_this.total = resp .data.totalElements
_this.pagesize = resp.data.size
// console.log (resp)
})
}