添加更新用户信息:
import {httpServe} from '@/http/index.js'
/* 登录 */
export const loginPost = (path="",data={})=> httpServe({path:path,method:'post',data:data});
/* 必须以对象方式传递 */
/* 左侧菜单列表 */
export const menusGet = (path="",params={})=> httpServe({path,params});
/* 用户列表 */
export const usersGet = (path="",params={})=> httpServe({path,params});
/* 添加用户 */
export const addusersPost = (path="",data={})=> httpServe({path,method:'post',data});
/* 删除用户 */
export const usersDelete = (path="")=> httpServe({path,method:'delete'});
/* 更新用户信息 */
export const usersPut = (path="",data={})=> httpServe({path,method:'put',data});
添加修改删除功能:
<template>
<div class="users">
<el-row>
<el-input
v-model="queryName"
placeholder="搜索用户名"
@keyup.native.enter="search"
style="width: 200px"
></el-input>
<el-button
icon="el-icon-search"
circle
@click="search"
style="margin-left: 15px"
></el-button>
<el-button type="primary" round @click="drawer = true"
>添加用户</el-button
>
</el-row>
<!-- :wrapperClosable="false" 表示点击遮罩区域不关闭抽屉 true则可以 -->
<el-drawer
title="添加用户"
:visible.sync="drawer"
:direction="direction"
:wrapperClosable="false"
>
<add-users @addok="addok" />
</el-drawer>
<!-- el-table组件 需要给data属性动态传递一个数组对象tableData -->
<el-table :data="tableData">
<!-- el-table-column组件 表格中的数据 是数组对象tableData中的属性date所对应的值
比如 date属性的值对应的2016-05-02 -->