perf(@vant/lazyload): reduce production log

This commit is contained in:
chenjiahan
2021-09-24 10:48:24 +08:00
committed by neverland
parent 00b1568887
commit 33d7aa8f1a
3 changed files with 22 additions and 8 deletions
+7 -2
View File
@@ -80,10 +80,15 @@ export default (lazyManager) => ({
},
load(onFinish = noop) {
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(
`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();
return;
}