美文网首页
(二十五)VueCli3.0全栈——展示资金管理页面

(二十五)VueCli3.0全栈——展示资金管理页面

作者: 彼得朱 | 来源:发表于2019-07-11 14:52 被阅读0次

1、client/src/views下面新建FundList文件

<template>
  <div class="fillContainer">
    <el-table
      v-if="tableData.length>0"
      :data="tableData"
      style="width: 100%"
      max-height="450"
      border
    >
      <el-table-column type="index" label="序号" width="70" align="center"></el-table-column>
      <el-table-column prop="date" label="创建时间" width="200" align="center">
        <template slot-scope="scope">
          <i class="el-icon-time"></i>
          <span style="margin-left: 10px">{{ scope.row.date }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="type" label="收支类型" width="120" align="center"></el-table-column>
      <el-table-column prop="describe" label="收支描述" width="160" align="center"></el-table-column>
      <el-table-column prop="income" label="收入" width="150" align="center">
        <template slot-scope="scope">
          <span style="color:#00d053">{{scope.row.income}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="expend" label="支出" width="150" align="center">
        <template slot-scope="scope">
          <span style="color:#f56767">{{scope.row.expend}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="cash" label="账户现金" width="150" align="center">
        <template slot-scope="scope">
          <span style="color:#4db3ff">{{scope.row.cash}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="remark" label="备注" width="180" align="center"></el-table-column>
      <el-table-column label="操作" align="center" width="180" fixed="right" prop="operation">
        <template slot-scope="scope">
          <el-button
            type="warning"
            icon="edit"
            size="small"
            @click="handleEdit(scope.$index, scope.row)"
          >编辑</el-button>
          <el-button
            size="small"
            type="danger"
            icon="delete"
            @click="handleDelete(scope.$index, scope.row)"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "fundlist",
  data() {
    return {
      tableData: []
    };
  },
  created() {
    this.getProfile();
  },
  methods: {
    getProfile() {
      // 获取表格数据
      this.$axios
        .get("/api/profiles")
        .then(res => {
          this.tableData = res.data;
        })
        .catch(err => console.log(err));
    },
    handleEdit(index, row) {
        console.log(123);
    },
    handleDelete(index, row) {
        console.log(456);
    }
  }
};
</script>

<style scoped>
.fillContainer{
    width: 100%;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
}
</style>

2、router.js里面引入和使用

import FundList from "./views/FundList"

{path:'/fundlist',name:'infoshow',component:FundList}

注意:是属于Index 的children

3、效果图

资金管理页面

相关文章

网友评论

      本文标题:(二十五)VueCli3.0全栈——展示资金管理页面

      本文链接:https://www.haomeiwen.com/subject/qmcdkctx.html