feat: migrate NoticeBar component

This commit is contained in:
chenjiahan
2020-07-25 16:28:40 +08:00
parent f74f1047fd
commit b3964e6afa
3 changed files with 22 additions and 20 deletions
+13 -12
View File
@@ -37,9 +37,13 @@ export default createComponent({
},
watch: {
scrollable: 'start',
scrollable() {
this.start();
},
text: {
handler: 'start',
handler() {
this.start();
},
immediate: true,
},
},
@@ -105,7 +109,8 @@ export default createComponent({
},
render() {
const { slots, mode, leftIcon, onClickIcon } = this;
const slots = this.$slots;
const { mode, leftIcon, onClickIcon } = this;
const barStyle = {
color: this.color,
@@ -118,10 +123,8 @@ export default createComponent({
};
function LeftIcon() {
const slot = slots('left-icon');
if (slot) {
return slot;
if (slots['left-icon']) {
return slots['left-icon']();
}
if (leftIcon) {
@@ -130,10 +133,8 @@ export default createComponent({
}
function RightIcon() {
const slot = slots('right-icon');
if (slot) {
return slot;
if (slots['right-icon']) {
return slots['right-icon']();
}
let iconName;
@@ -175,7 +176,7 @@ export default createComponent({
style={contentStyle}
onTransitionend={this.onTransitionEnd}
>
{this.slots() || this.text}
{slots.default?.() || this.text}
</div>
</div>
{RightIcon()}