1. class绑定
<div :class="['el-notification', customClass, horizontalClass]"
</div>
computed: {
typeClass() {
return this.type && typeMap[this.type] ? `el-icon-${ typeMap[this.type] }` : '';
},
horizontalClass() {
return this.position.indexOf('right') > -1 ? 'right' : 'left';
},
}
2. style绑定
<div
:class="['el-notification', customClass, horizontalClass]"
v-show="visible"
:style="positionStyle"
@mouseenter="clearTimer()"
@mouseleave="startTimer()"
@click="click"
role="alert"
>
</div>
computed: {
positionStyle() {
return {
[this.verticalProperty]: `${ this.verticalOffset }px`
};
}
}
|