mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix: add info prop deprecation warning (#7352)
This commit is contained in:
parent
3fe485c959
commit
7d0f4fc9ed
@ -15,6 +15,7 @@ export default createComponent({
|
|||||||
text: String,
|
text: String,
|
||||||
icon: String,
|
icon: String,
|
||||||
color: String,
|
color: String,
|
||||||
|
// @deprecated
|
||||||
info: [Number, String],
|
info: [Number, String],
|
||||||
badge: [Number, String],
|
badge: [Number, String],
|
||||||
iconClass: null,
|
iconClass: null,
|
||||||
@ -30,6 +31,12 @@ export default createComponent({
|
|||||||
const slot = this.slots('icon');
|
const slot = this.slots('icon');
|
||||||
const info = this.badge ?? this.info;
|
const info = this.badge ?? this.info;
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== 'production' && this.info) {
|
||||||
|
console.warn(
|
||||||
|
'[Vant] GoodsActionIcon: "info" prop is deprecated, use "badge" prop instead.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (slot) {
|
if (slot) {
|
||||||
return (
|
return (
|
||||||
<div class={bem('icon')}>
|
<div class={bem('icon')}>
|
||||||
|
@ -21,6 +21,7 @@ export default createComponent({
|
|||||||
text: String,
|
text: String,
|
||||||
icon: String,
|
icon: String,
|
||||||
iconPrefix: String,
|
iconPrefix: String,
|
||||||
|
// @deprecated
|
||||||
info: [Number, String],
|
info: [Number, String],
|
||||||
badge: [Number, String],
|
badge: [Number, String],
|
||||||
},
|
},
|
||||||
@ -73,6 +74,12 @@ export default createComponent({
|
|||||||
const iconSlot = this.slots('icon');
|
const iconSlot = this.slots('icon');
|
||||||
const info = this.badge ?? this.info;
|
const info = this.badge ?? this.info;
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== 'production' && this.info) {
|
||||||
|
console.warn(
|
||||||
|
'[Vant] GridItem: "info" prop is deprecated, use "badge" prop instead.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (iconSlot) {
|
if (iconSlot) {
|
||||||
return (
|
return (
|
||||||
<div class={bem('icon-wrapper')}>
|
<div class={bem('icon-wrapper')}>
|
||||||
|
@ -11,6 +11,7 @@ export default createComponent({
|
|||||||
props: {
|
props: {
|
||||||
...routeProps,
|
...routeProps,
|
||||||
dot: Boolean,
|
dot: Boolean,
|
||||||
|
// @deprecated
|
||||||
info: [Number, String],
|
info: [Number, String],
|
||||||
badge: [Number, String],
|
badge: [Number, String],
|
||||||
title: String,
|
title: String,
|
||||||
@ -37,6 +38,12 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
if (process.env.NODE_ENV !== 'production' && this.info) {
|
||||||
|
console.warn(
|
||||||
|
'[Vant] SidebarItem: "info" prop is deprecated, use "badge" prop instead.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
class={bem({ select: this.select, disabled: this.disabled })}
|
class={bem({ select: this.select, disabled: this.disabled })}
|
||||||
|
@ -11,6 +11,7 @@ export default createComponent({
|
|||||||
...routeProps,
|
...routeProps,
|
||||||
dot: Boolean,
|
dot: Boolean,
|
||||||
name: [Number, String],
|
name: [Number, String],
|
||||||
|
// @deprecated
|
||||||
info: [Number, String],
|
info: [Number, String],
|
||||||
badge: [Number, String],
|
badge: [Number, String],
|
||||||
title: String,
|
title: String,
|
||||||
@ -57,6 +58,12 @@ export default createComponent({
|
|||||||
const { slots, parent, isActive } = this;
|
const { slots, parent, isActive } = this;
|
||||||
const slotContent = slots();
|
const slotContent = slots();
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== 'production' && this.info) {
|
||||||
|
console.warn(
|
||||||
|
'[Vant] Tab: "info" prop is deprecated, use "badge" prop instead.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!slotContent) {
|
if (!slotContent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ export default createComponent({
|
|||||||
dot: Boolean,
|
dot: Boolean,
|
||||||
icon: String,
|
icon: String,
|
||||||
name: [Number, String],
|
name: [Number, String],
|
||||||
|
// @deprecated
|
||||||
info: [Number, String],
|
info: [Number, String],
|
||||||
badge: [Number, String],
|
badge: [Number, String],
|
||||||
iconPrefix: String,
|
iconPrefix: String,
|
||||||
@ -67,6 +68,12 @@ export default createComponent({
|
|||||||
const active = this.parent.route ? this.routeActive : this.active;
|
const active = this.parent.route ? this.routeActive : this.active;
|
||||||
const color = this.parent[active ? 'activeColor' : 'inactiveColor'];
|
const color = this.parent[active ? 'activeColor' : 'inactiveColor'];
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== 'production' && this.info) {
|
||||||
|
console.warn(
|
||||||
|
'[Vant] TabbarItem: "info" prop is deprecated, use "badge" prop instead.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={bem({ active })} style={{ color }} onClick={this.onClick}>
|
<div class={bem({ active })} style={{ color }} onClick={this.onClick}>
|
||||||
<div class={bem('icon')}>
|
<div class={bem('icon')}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user