mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
perf(@vant/lazyload): reduce production log
This commit is contained in:
parent
00b1568887
commit
33d7aa8f1a
@ -80,10 +80,15 @@ export default (lazyManager) => ({
|
|||||||
},
|
},
|
||||||
load(onFinish = noop) {
|
load(onFinish = noop) {
|
||||||
if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
|
if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
|
||||||
if (!lazyManager.options.silent)
|
if (
|
||||||
|
process.env.NODE_ENV !== 'production' &&
|
||||||
|
!lazyManager.options.silent
|
||||||
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
`VueLazyload log: ${this.options.src} tried too more than ${this.options.attempt} times`
|
`[@vant/lazyload] ${this.options.src} tried too more than ${this.options.attempt} times`
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
onFinish();
|
onFinish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -472,8 +472,14 @@ export default function () {
|
|||||||
|
|
||||||
// value is object
|
// value is object
|
||||||
if (isObject(value)) {
|
if (isObject(value)) {
|
||||||
if (!value.src && !this.options.silent)
|
if (
|
||||||
console.error('Vue Lazyload warning: miss src with ' + value);
|
process.env.NODE_ENV !== 'production' &&
|
||||||
|
!value.src &&
|
||||||
|
!this.options.silent
|
||||||
|
) {
|
||||||
|
console.error('[@vant/lazyload] miss src with ' + value);
|
||||||
|
}
|
||||||
|
|
||||||
({ src } = value);
|
({ src } = value);
|
||||||
loading = value.loading || this.options.loading;
|
loading = value.loading || this.options.loading;
|
||||||
error = value.error || this.options.error;
|
error = value.error || this.options.error;
|
||||||
|
@ -140,9 +140,10 @@ export default class ReactiveListener {
|
|||||||
// handler `loading image` load failed
|
// handler `loading image` load failed
|
||||||
cb();
|
cb();
|
||||||
this.state.loading = false;
|
this.state.loading = false;
|
||||||
if (!this.options.silent)
|
|
||||||
|
if (process.env.NODE_ENV !== 'production' && !this.options.silent)
|
||||||
console.warn(
|
console.warn(
|
||||||
`VueLazyload log: load failed with loading image(${this.loading})`
|
`[@vant/lazyload] load failed with loading image(${this.loading})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -154,10 +155,12 @@ export default class ReactiveListener {
|
|||||||
*/
|
*/
|
||||||
load(onFinish = noop) {
|
load(onFinish = noop) {
|
||||||
if (this.attempt > this.options.attempt - 1 && this.state.error) {
|
if (this.attempt > this.options.attempt - 1 && this.state.error) {
|
||||||
if (!this.options.silent)
|
if (process.env.NODE_ENV !== 'production' && !this.options.silent) {
|
||||||
console.log(
|
console.log(
|
||||||
`VueLazyload log: ${this.src} tried too more than ${this.options.attempt} times`
|
`[@vant/lazyload] ${this.src} tried too more than ${this.options.attempt} times`
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
onFinish();
|
onFinish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user