silent
Cancel all logging and warning on Vue.
- Type:
boolean
- Default value:
false
- Usage:
Vue.config.silent = true
Copy the code
- Core source code:
var config = ({
// ...
silent: false.
// ...
})
// ...
// Empty function, also called placeholder function
function noop (a, b, c) {}
var warn = noop;
var tip = noop;
var hasConsole = typeof console.log ! = ='undefined'
/ / warning
warn = function (msg, vm) {
var trace = vm ? generateComponentTrace(vm) : ' ';
// ...
if (/ *... * /) {
// ...
} else if(hasConsole && (! config.silent)) {
console.error(("[Vue warn]: " + msg + trace));
}
}
/ / log
tip = function (msg, vm) {
if(hasConsole && (! config.silent)) {
console.warn("[Vue tip]: " + msg + (
vm ? generateComponentTrace(vm) : ' '
))
}
}
Copy the code
Appendix: github.com/fanqiewa/vu…