<bst-button/>
是基于 <el-button/>
(opens new window) 组件的二次封装扩展
扩展功能
- 支持设置按钮文本颜色,增加了
textColor
属性。 - 支持点击按钮发起异步请求,增加了
ajax
属性。 - 支持点击按钮在发起异步请求之前做二次提醒,增加了
twiceHint
、hintText
属性。
- 如果是 删除 按钮,支持自动设置二次提醒文本为“您确定要删除吗?",无需开发者配置提示文案。
- 支持在请求发送之前、请求响应之前和之后对数据进行拦截处理,增加了
beforeRequest
、beforeResponse
、afterResponse
属性。
基础使用
属性
支持所有<el-button/> (opens new window)的属性,以下是扩展的属于列表
属性 | 说明 | 类型 | 默认值 |
textColor | 文本颜色 - 可选值 [blue,red,green] | String | null |
twiceHint | 二次提示 | Boolean | false |
hintText | 二次提示文本 | String | null |
ajax | ajax请求配置 | AjaxConfig | null |
beforeRequest | 请求发送之前的钩子函数 | Function | null |
beforeResponse | 请求响应之前的钩子函数 | Function | null |
afterResponse | 请求响应之后的钩子函数 | Function | null |
AjaxConfig
属性 | 说明 | 类型 | 默认值 |
method | 请求方法 - 可选值 [get,post] | String | null |
url | 请求地址 | String | null |
params | 请求方式为get时的请求参数 | Object | null |
data | 请求方式为post时的请求体数据 | Object | null |
方法
事件
插槽
编辑此文档 (opens new window)