BaseTable.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <el-table
  3. :data="tableData"
  4. style="width: 100%">
  5. <el-table-column
  6. prop="code"
  7. label="编码"
  8. width="180">
  9. </el-table-column>
  10. <el-table-column
  11. prop="name"
  12. label="名称"
  13. width="180">
  14. </el-table-column>
  15. </el-table>
  16. </template>
  17. <script>
  18. import Vue from 'vue';
  19. import ElementUI from 'element-ui';
  20. import Axios from 'axios';
  21. import 'element-ui/lib/theme-chalk/index.css';
  22. Vue.use(ElementUI);
  23. // http://api.sagacloud.cn/data-platform-3/dict/query/climate
  24. export default{
  25. data: function () {
  26. return {
  27. tableData: [{
  28. date: '2016-05-02',
  29. name: '王小虎',
  30. address: '上海市普陀区金沙江路 1518 弄'
  31. }, {
  32. date: '2016-05-04',
  33. name: '王小虎',
  34. address: '上海市普陀区金沙江路 1517 弄'
  35. }, {
  36. date: '2016-05-01',
  37. name: '王小虎',
  38. address: '上海市普陀区金沙江路 1519 弄'
  39. }, {
  40. date: '2016-05-03',
  41. name: '王小虎',
  42. address: '上海市普陀区金沙江路 1516 弄'
  43. }]
  44. };
  45. },
  46. components: {},
  47. created: function () {
  48. this.getData()
  49. },
  50. mounted: function () {
  51. },
  52. computed: {},
  53. methods: {
  54. getData(){
  55. Axios.get('http://api.sagacloud.cn/data-platform-3/dict/query/climate',{}).then(res=>{
  56. this.tableData = res.data.Content;
  57. })
  58. }
  59. },
  60. }
  61. </script>