Last active
August 9, 2019 10:04
-
-
Save wisetc/aebffa1cac04377a7062f3bd68621be2 to your computer and use it in GitHub Desktop.
增删改查报告结果
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Message } from 'element-ui' | |
| function noop {} | |
| export default function report (data, type='', callback=noop) { | |
| let map = { | |
| create: '新增', | |
| update: '修改', | |
| destroy: '删除' | |
| } | |
| let msg = map[type] || type || '操作' | |
| if (data.code === 1) { | |
| Message.success(msg + '成功') | |
| typeof callback === 'function' && callback(data) | |
| } else { | |
| Message.error(msg + '失败。' + data.msg) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment