chore: improve alert type
parent
f8ada772ae
commit
64b51f22af
|
@ -14,6 +14,7 @@ import PropTypes from '../_util/vue-types';
|
||||||
import { getTransitionProps, Transition } from '../_util/transition';
|
import { getTransitionProps, Transition } from '../_util/transition';
|
||||||
import { getComponent, isValidElement, findDOMNode } from '../_util/props-util';
|
import { getComponent, isValidElement, findDOMNode } from '../_util/props-util';
|
||||||
import { defaultConfigProvider } from '../config-provider';
|
import { defaultConfigProvider } from '../config-provider';
|
||||||
|
import { tuple } from '../_util/type';
|
||||||
|
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export const AlertProps = {
|
||||||
/**
|
/**
|
||||||
* Type of Alert styles, options:`success`, `info`, `warning`, `error`
|
* Type of Alert styles, options:`success`, `info`, `warning`, `error`
|
||||||
*/
|
*/
|
||||||
type: PropTypes.oneOf(['success', 'info', 'warning', 'error']),
|
type: PropTypes.oneOf(tuple('success', 'info', 'warning', 'error')),
|
||||||
/** Whether Alert can be closed */
|
/** Whether Alert can be closed */
|
||||||
closable: PropTypes.looseBool,
|
closable: PropTypes.looseBool,
|
||||||
/** Close text to show */
|
/** Close text to show */
|
||||||
|
@ -98,7 +99,7 @@ const Alert = defineComponent({
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { prefixCls: customizePrefixCls, banner, closing, closed, $attrs } = this;
|
const { prefixCls: customizePrefixCls, banner, closing, closed, $attrs } = this;
|
||||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
const { getPrefixCls } = this.configProvider;
|
||||||
const prefixCls = getPrefixCls('alert', customizePrefixCls);
|
const prefixCls = getPrefixCls('alert', customizePrefixCls);
|
||||||
|
|
||||||
let { closable, type, showIcon } = this;
|
let { closable, type, showIcon } = this;
|
||||||
|
|
Loading…
Reference in New Issue