BaseTable.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. };
  29. },
  30. components: {},
  31. created: function () {
  32. this.getData()
  33. },
  34. mounted: function () {
  35. },
  36. computed: {},
  37. methods: {
  38. getData(){
  39. Axios.get('http://api.sagacloud.cn/data-platform-3/dict/query/climate',{}).then(res=>{
  40. this.tableData = res.data.Content;
  41. })
  42. }
  43. },
  44. }
  45. </script>