| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 | <template>	<view class="u-alert-tips" v-if="show" :class="[		!show ? 'u-close-alert-tips': '',		type ? 'u-alert-tips--bg--' + type + '-light' : '',		type ? 'u-alert-tips--border--' + type + '-disabled' : '',	]" :style="{		backgroundColor: bgColor,		borderColor: borderColor	}">		<view class="u-icon-wrap">			<u-icon v-if="showIcon" :name="uIcon" :size="description ? 40 : 32" class="u-icon" :color="uIconType" :custom-style="iconStyle"></u-icon>		</view>		<view class="u-alert-content" @tap.stop="click">			<view class="u-alert-title" :style="[uTitleStyle]">				{{title}}			</view>			<view v-if="description" class="u-alert-desc" :style="[descStyle]">				{{description}}			</view>		</view>		<view class="u-icon-wrap">			<u-icon @click="close" v-if="closeAble && !closeText" hoverClass="u-type-error-hover-color" name="close" color="#c0c4cc"			 :size="22" class="u-close-icon" :style="{				top: description ? '18rpx' : '24rpx'			}"></u-icon>		</view>		<text v-if="closeAble && closeText" class="u-close-text" :style="{			top: description ? '18rpx' : '24rpx'		}">{{closeText}}</text>	</view></template><script>		export default {		name: 'u-alert-tips',		props: {						title: {				type: String,				default: ''			},						type: {				type: String,				default: 'warning'			},						description: {				type: String,				default: ''			},						closeAble: {				type: Boolean,				default: false			},						closeText: {				type: String,				default: ''			},						showIcon: {				type: Boolean,				default: false			},						color: {				type: String,				default: ''			},						bgColor: {				type: String,				default: ''			},						borderColor: {				type: String,				default: ''			},						show: {				type: Boolean,				default: true			},						icon: {				type: String,				default: ''			},						iconStyle: {				type: Object,				default() {					return {}				}			},						titleStyle: {				type: Object,				default() {					return {}				}			},						descStyle: {				type: Object,				default() {					return {}				}			},		},		data() {			return {			}		},		computed: {			uTitleStyle() {				let style = {};								style.fontWeight = this.description ? 500 : 'normal';								return this.$u.deepMerge(style, this.titleStyle);			},			uIcon() {								return this.icon ? this.icon : this.$u.type2icon(this.type);			},			uIconType() {								return Object.keys(this.iconStyle).length ? '' : this.type;			}		},		methods: {						click() {				this.$emit('click');			},						close() {				this.$emit('close');			}		}	}</script><style lang="scss" scoped>	@import "../../libs/css/style.components.scss";		.u-alert-tips {		@include vue-flex;		align-items: center;		padding: 16rpx 30rpx;		border-radius: 8rpx;		position: relative;		transition: all 0.3s linear;		border: 1px solid #fff;				&--bg--primary-light {			background-color: $u-type-primary-light;		}				&--bg--info-light {			background-color: $u-type-info-light;		}				&--bg--success-light {			background-color: $u-type-success-light;		}				&--bg--warning-light {			background-color: $u-type-warning-light;		}				&--bg--error-light {			background-color: $u-type-error-light;		}				&--border--primary-disabled {			border-color: $u-type-primary-disabled;		}				&--border--success-disabled {			border-color: $u-type-success-disabled;		}				&--border--error-disabled {			border-color: $u-type-error-disabled;		}				&--border--warning-disabled {			border-color: $u-type-warning-disabled;		}				&--border--info-disabled {			border-color: $u-type-info-disabled;		}	}	.u-close-alert-tips {		opacity: 0;		visibility: hidden;	}	.u-icon {		margin-right: 16rpx;	}	.u-alert-title {		font-size: 28rpx;		color: $u-main-color;	}	.u-alert-desc {		font-size: 26rpx;		text-align: left;		color: $u-content-color;	}	.u-close-icon {		position: absolute;		top: 20rpx;		right: 20rpx;	}	.u-close-hover {		color: red;	}		.u-close-text {		font-size: 24rpx;		color: $u-tips-color;		position: absolute;		top: 20rpx;		right: 20rpx;		line-height: 1;	}</style>
 |