github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/public/libs/vue-1.0.24/src/util/debug.js (about)

     1  import config from '../config'
     2  import { hyphenate } from './lang'
     3  
     4  let warn
     5  let formatComponentName
     6  
     7  if (process.env.NODE_ENV !== 'production') {
     8    const hasConsole = typeof console !== 'undefined'
     9  
    10    warn = (msg, vm) => {
    11      if (hasConsole && (!config.silent)) {
    12        console.error('[Vue warn]: ' + msg + (vm ? formatComponentName(vm) : ''))
    13      }
    14    }
    15  
    16    formatComponentName = vm => {
    17      var name = vm._isVue ? vm.$options.name : vm.name
    18      return name
    19        ? ' (found in component: <' + hyphenate(name) + '>)'
    20        : ''
    21    }
    22  }
    23  
    24  export { warn }