[new feature] Toast: add iconPrefix option (#3872)

This commit is contained in:
neverland
2019-07-17 10:34:02 +08:00
committed by GitHub
parent e653484f39
commit 1c09a44751
6 changed files with 24 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ export default createComponent({
props: {
icon: String,
className: null,
iconPrefix: String,
loadingType: String,
forbidClick: Boolean,
message: [Number, String],
@@ -77,13 +78,13 @@ export default createComponent({
},
render(h) {
const { type, icon, message, loadingType } = this;
const { type, icon, message, iconPrefix, loadingType } = this;
const hasIcon = icon || (type === 'success' || type === 'fail');
function ToastIcon() {
if (hasIcon) {
return <Icon class={bem('icon')} name={icon || type} />;
return <Icon class={bem('icon')} classPrefix={iconPrefix} name={icon || type} />;
}
if (type === 'loading') {