https://blog.csdn.net/weixin_36706903/article/details/81706857ios
页面展现:数据库
数据库字段名:axios
跨域:api
config里的index文件里的dev里面的proxyTable里面添加本身的后台端口,这样就能很方便的请求后台数据了跨域
'/api':{post
target:'http://localhost:9987',this
changeOrigin:true,.net
pathRewrite:{代理
'/api':''code
}
<template> <el-table :data="packData" border style="width: 100%"> <el-table-column type="selection" width="55"></el-table-column> <el-table-column prop="PackingId" label="包装编号" width="120">//prop里的值是数据库表里的对应字段名 </el-table-column> <el-table-column prop="PackingName" label="包装名称" width="120"> </el-table-column> <el-table-column prop="PackingPrice" label="包装价格" width="120"> </el-table-column> <el-table-column prop="PackingImage" label="包装图片"> </el-table-column> </el-table> </template>
</script> export default { name: 'pack', data() { return { packData:[],//主题数据 }} methods:{ // 获取 包装数据,由于搜索后分页数据会变化,因此这里能够传值到后台判断是否进行了搜索展现,这里只作简单展现,不考虑搜索和分页 getPackData() { //我用的api代理 this.$axios.post('/api/selectPackPageMade.do').then((res) => { this.packData = res.data;//把传回来数据赋给packData }).catch(function(error){ console.log(error); }) },} } </script>