mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat: migrate NoticeBar component
This commit is contained in:
parent
f74f1047fd
commit
b3964e6afa
@ -31,4 +31,5 @@ module.exports = [
|
|||||||
'pagination',
|
'pagination',
|
||||||
'sidebar',
|
'sidebar',
|
||||||
'tree-select',
|
'tree-select',
|
||||||
|
'notice-bar',
|
||||||
];
|
];
|
||||||
|
@ -37,9 +37,13 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
scrollable: 'start',
|
scrollable() {
|
||||||
|
this.start();
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
handler: 'start',
|
handler() {
|
||||||
|
this.start();
|
||||||
|
},
|
||||||
immediate: true,
|
immediate: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -105,7 +109,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { slots, mode, leftIcon, onClickIcon } = this;
|
const slots = this.$slots;
|
||||||
|
const { mode, leftIcon, onClickIcon } = this;
|
||||||
|
|
||||||
const barStyle = {
|
const barStyle = {
|
||||||
color: this.color,
|
color: this.color,
|
||||||
@ -118,10 +123,8 @@ export default createComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
function LeftIcon() {
|
function LeftIcon() {
|
||||||
const slot = slots('left-icon');
|
if (slots['left-icon']) {
|
||||||
|
return slots['left-icon']();
|
||||||
if (slot) {
|
|
||||||
return slot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftIcon) {
|
if (leftIcon) {
|
||||||
@ -130,10 +133,8 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function RightIcon() {
|
function RightIcon() {
|
||||||
const slot = slots('right-icon');
|
if (slots['right-icon']) {
|
||||||
|
return slots['right-icon']();
|
||||||
if (slot) {
|
|
||||||
return slot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let iconName;
|
let iconName;
|
||||||
@ -175,7 +176,7 @@ export default createComponent({
|
|||||||
style={contentStyle}
|
style={contentStyle}
|
||||||
onTransitionend={this.onTransitionEnd}
|
onTransitionend={this.onTransitionEnd}
|
||||||
>
|
>
|
||||||
{this.slots() || this.text}
|
{slots.default?.() || this.text}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{RightIcon()}
|
{RightIcon()}
|
||||||
|
@ -253,10 +253,10 @@ module.exports = {
|
|||||||
// path: 'list',
|
// path: 'list',
|
||||||
// title: 'List 列表',
|
// title: 'List 列表',
|
||||||
// },
|
// },
|
||||||
// {
|
{
|
||||||
// path: 'notice-bar',
|
path: 'notice-bar',
|
||||||
// title: 'NoticeBar 通知栏',
|
title: 'NoticeBar 通知栏',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'progress',
|
path: 'progress',
|
||||||
title: 'Progress 进度条',
|
title: 'Progress 进度条',
|
||||||
@ -587,10 +587,10 @@ module.exports = {
|
|||||||
// path: 'list',
|
// path: 'list',
|
||||||
// title: 'List',
|
// title: 'List',
|
||||||
// },
|
// },
|
||||||
// {
|
{
|
||||||
// path: 'notice-bar',
|
path: 'notice-bar',
|
||||||
// title: 'NoticeBar',
|
title: 'NoticeBar',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'progress',
|
path: 'progress',
|
||||||
title: 'Progress',
|
title: 'Progress',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user