make Message and Notice support render
This commit is contained in:
parent
8a0cb3ce80
commit
b24be35a7e
8 changed files with 99 additions and 16 deletions
|
@ -33,6 +33,7 @@ function notice (type, options) {
|
|||
const desc = options.desc || '';
|
||||
const noticeKey = options.name || `${prefixKey}${name}`;
|
||||
const onClose = options.onClose || function () {};
|
||||
const render = options.render;
|
||||
// todo const btn = options.btn || null;
|
||||
const duration = (options.duration === 0) ? 0 : options.duration || defaultDuration;
|
||||
|
||||
|
@ -42,9 +43,12 @@ function notice (type, options) {
|
|||
|
||||
let content;
|
||||
|
||||
const with_desc = desc === '' ? '' : ` ${prefixCls}-with-desc`;
|
||||
let withIcon;
|
||||
|
||||
const with_desc = (options.render && !title) ? '' : desc === '' ? '' : ` ${prefixCls}-with-desc`;
|
||||
|
||||
if (type == 'normal') {
|
||||
withIcon = false;
|
||||
content = `
|
||||
<div class="${prefixCls}-custom-content ${prefixCls}-with-normal${with_desc}">
|
||||
<div class="${prefixCls}-title">${title}</div>
|
||||
|
@ -53,6 +57,7 @@ function notice (type, options) {
|
|||
`;
|
||||
} else {
|
||||
const iconType = iconTypes[type];
|
||||
withIcon = true;
|
||||
content = `
|
||||
<div class="${prefixCls}-custom-content ${prefixCls}-with-icon ${prefixCls}-with-${type}${with_desc}">
|
||||
<span class="${prefixCls}-icon ${prefixCls}-icon-${type}">
|
||||
|
@ -63,13 +68,14 @@ function notice (type, options) {
|
|||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
instance.notice({
|
||||
name: noticeKey.toString(),
|
||||
duration: duration,
|
||||
styles: {},
|
||||
transitionName: 'move-notice',
|
||||
content: content,
|
||||
withIcon: withIcon,
|
||||
render: render,
|
||||
onClose: onClose,
|
||||
closable: true,
|
||||
type: 'notice'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue