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,
|
||||
icon: String,
|
||||
color: String,
|
||||
// @deprecated
|
||||
info: [Number, String],
|
||||
badge: [Number, String],
|
||||
iconClass: null,
|
||||
@ -30,6 +31,12 @@ export default createComponent({
|
||||
const slot = this.slots('icon');
|
||||
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) {
|
||||
return (
|
||||
<div class={bem('icon')}>
|
||||
|
@ -21,6 +21,7 @@ export default createComponent({
|
||||
text: String,
|
||||
icon: String,
|
||||
iconPrefix: String,
|
||||
// @deprecated
|
||||
info: [Number, String],
|
||||
badge: [Number, String],
|
||||
},
|
||||
@ -73,6 +74,12 @@ export default createComponent({
|
||||
const iconSlot = this.slots('icon');
|
||||
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) {
|
||||
return (
|
||||
<div class={bem('icon-wrapper')}>
|
||||
|
@ -11,6 +11,7 @@ export default createComponent({
|
||||
props: {
|
||||
...routeProps,
|
||||
dot: Boolean,
|
||||
// @deprecated
|
||||
info: [Number, String],
|
||||
badge: [Number, String],
|
||||
title: String,
|
||||
@ -37,6 +38,12 @@ export default createComponent({
|
||||
},
|
||||
|
||||
render() {
|
||||
if (process.env.NODE_ENV !== 'production' && this.info) {
|
||||
console.warn(
|
||||
'[Vant] SidebarItem: "info" prop is deprecated, use "badge" prop instead.'
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<a
|
||||
class={bem({ select: this.select, disabled: this.disabled })}
|
||||
|
@ -11,6 +11,7 @@ export default createComponent({
|
||||
...routeProps,
|
||||
dot: Boolean,
|
||||
name: [Number, String],
|
||||
// @deprecated
|
||||
info: [Number, String],
|
||||
badge: [Number, String],
|
||||
title: String,
|
||||
@ -57,6 +58,12 @@ export default createComponent({
|
||||
const { slots, parent, isActive } = this;
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ export default createComponent({
|
||||
dot: Boolean,
|
||||
icon: String,
|
||||
name: [Number, String],
|
||||
// @deprecated
|
||||
info: [Number, String],
|
||||
badge: [Number, String],
|
||||
iconPrefix: String,
|
||||
@ -67,6 +68,12 @@ export default createComponent({
|
||||
const active = this.parent.route ? this.routeActive : this.active;
|
||||
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 (
|
||||
<div class={bem({ active })} style={{ color }} onClick={this.onClick}>
|
||||
<div class={bem('icon')}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user